Permalink
Switch branches/tags
v2_4_2@3681 v2_4_2@5 v2_4_2@3 v2_4_2 releases@3681 releases prepare-depth-dbm-fc-solve-for-amazon-aws--two-remaining-4fc-deals--take1--2016-12-26 prepare-depth-dbm-fc-solve-for-amazon-aws--take1--2016-11-04 latest-devel@3681 latest-devel@737 latest-devel@619 latest-devel@573 latest-devel gcc-4.5-slowdown-Before@3681 gcc-4.5-slowdown-Before@2947 gcc-4.5-slowdown-Before@2910 gcc-4.5-slowdown-Before@2909 gcc-4.5-slowdown-Before gcc-4.5-slowdown-After@3681 gcc-4.5-slowdown-After@2949 gcc-4.5-slowdown-After@2910 gcc-4.5-slowdown-After@2909 gcc-4.5-slowdown-After freecell-solver-4.20.0 freecell-solver-4.18.0 freecell-solver-4.16.0 freecell-solver-4.14.1 freecell-solver-4.14.0 freecell-solver-4.12.1 freecell-solver-4.12.0 freecell-solver-4.10.0 freecell-solver-4.8.0 freecell-solver-4.6.1 freecell-solver-4.6.0 freecell-solver-4.4.0 freecell-solver-4.2.0 freecell-solver-4.0.2 freecell-solver-4.0.1 freecell-solver-4.0.0 freecell-solver-3.27.0 freecell-solver-3.26.0 freecell-solver-3.24.0 freecell-solver-3.22.0 freecell-solver-3.21.5 freecell-solver-3.20.1 freecell-solver-3.20.0 freecell-solver-3.18.1 freecell-solver-3.18.0 freecell-solver-3.17.3-testsuite-and-rpmbuild-working-on-32-bit freecell-solver-3.16.0 freecell-solver-3.14.1 freecell-solver-3.14.0 freecell-solver-3.12.0 freecell-solver-3.11.0 depth_dbm_fc_solver_100M_4fc_intractables_for_Amadiro depth_dbm_fc_solver_100M_short_solutions_for_amadiro depth_dbm_fc_solver_100K_to_400k_run_with_500GB depth_dbm_fc_solver_100K_to_400k_run_with_500GB_with_fixed_avl_tree depth_dbm_fc_solver_100K_to_400k_run_with_500GB_take7 dbm_fcs_for_subanark.tar.gz dbm_fcs_for_amadiro-WITH_RAM_OPTIMISATIONS-try2.tar.gz dbm_fcs_for_amadiro-WITH_RAM_OPTIMISATIONS-try1.tar.gz dbm_fc_solver_32001_to_50000_tar.gz dbm_fc_solver_100K_to_400k.tar.gz dbm_fc_solver_100K_to_400k_run_with_500GB dbm_fc_solver_100K_to_400k_run_with_500GB_take4 dbm_fc_solver_100K_to_400k_run_with_127GB dbm_fc_solver_100K_to_400k-127GB-take2.tar.gz dbm_fc_solver_50K_to_100K_tar.gz before-remove-cmake-generated-files-in-dot-dir asciidoc.vim-USAGE-bug@3681 asciidoc.vim-USAGE-bug@2188 asciidoc.vim-USAGE-bug@2183 asciidoc.vim-USAGE-bug Task-FreecellSolver-Testing@3681 Task-FreecellSolver-Testing Task-FreecellSolver-Testing-MultiConfig-0.0.1 Task-FreecellSolver-Testing-0.0.11 Task-FreecellSolver-Testing-0.0.10 Task-FreecellSolver-Testing-0.0.9 Task-FreecellSolver-Testing-0.0.8 Task-FreecellSolver-Testing-0.0.7 Task-FreecellSolver-Testing-0.0.6 Task-FreecellSolver-Testing-0.0.5 Task-FreecellSolver-Testing-0.0.4 Task-FreecellSolver-Testing-0.0.3 MALLOC_CHECK_-problems@3681 MALLOC_CHECK_-problems@1946 MALLOC_CHECK_-problems LATEST_DEVEL@3681 LATEST_DEVEL@573 LATEST_DEVEL Initial_CVS@3681 Initial_CVS@41 Initial_CVS@3 Initial_CVS Games-Solitaire-Verify@3681 Games-Solitaire-Verify Games-Solitaire-Verify-0.1800 Games-Solitaire-Verify-0.1701
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (53 sloc) 1.72 KB
/*
* This file is part of Freecell Solver. It is subject to the license terms in
* the COPYING.txt file found in the top-level directory of this distribution
* and at http://fc-solve.shlomifish.org/docs/distro/COPYING.html . No part of
* Freecell Solver, including this file, may be copied, modified, propagated,
* or distributed except according to the terms contained in the COPYING file.
*
* Copyright (c) 2000 Shlomi Fish
*/
// gen_ms_boards__rand.h - a header file that defines some
// static (and preferably inline) routines for the MS Freecell deals
// generation random number generator.
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "rinutils.h"
typedef uint32_t microsoft_rand_uint;
typedef long long microsoft_rand;
static inline microsoft_rand microsoft_rand__calc_init_seedx(
const microsoft_rand deal_idx)
{
return (microsoft_rand_uint)(
(deal_idx < 0x100000000LL) ? deal_idx : (deal_idx - 0x100000000LL));
}
static inline microsoft_rand_uint microsoft_rand_rand(
microsoft_rand *const my_rand)
{
*my_rand = ((*my_rand) * 214013 + 2531011);
return ((*my_rand) >> 16) & 0x7fff;
}
static inline microsoft_rand_uint microsoft_rand_randp(
microsoft_rand *const my_rand)
{
*my_rand = ((*my_rand) * 214013 + 2531011);
return ((*my_rand) >> 16) & 0xffff;
}
static inline microsoft_rand_uint microsoft_rand__game_num_rand(
microsoft_rand *const seedx_ptr, const long long gnGameNumber)
{
if (gnGameNumber < 0x100000000LL)
{
const microsoft_rand_uint ret = microsoft_rand_rand(seedx_ptr);
return ((gnGameNumber < 0x80000000) ? ret : (ret | 0x8000));
}
else
{
return microsoft_rand_randp(seedx_ptr) + 1;
}
}
#ifdef __cplusplus
}
#endif