chiark
/
gitweb
/
~ian
/
sgt-puzzles.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
The Windows RNG turns out to only give about 16 bits at a time. This
[sgt-puzzles.git]
/
fifteen.c
diff --git
a/fifteen.c
b/fifteen.c
index 74fd4fc5970db564237d7a31e9d8ef601ab69b02..3965844da94baf8909d90101d12a44cd84a2d7c5 100644
(file)
--- a/
fifteen.c
+++ b/
fifteen.c
@@
-131,7
+131,7
@@
int perm_parity(int *perm, int n)
return ret;
}
return ret;
}
-char *new_game_seed(game_params *params)
+char *new_game_seed(game_params *params
, random_state *rs
)
{
int gap, n, i, x;
int x1, x2, p1, p2, parity;
{
int gap, n, i, x;
int x1, x2, p1, p2, parity;
@@
-149,7
+149,7
@@
char *new_game_seed(game_params *params)
used[i] = FALSE;
}
used[i] = FALSE;
}
- gap = rand
_upto(
n);
+ gap = rand
om_upto(rs,
n);
tiles[gap] = 0;
used[0] = TRUE;
tiles[gap] = 0;
used[0] = TRUE;
@@
-157,7
+157,7
@@
char *new_game_seed(game_params *params)
* Place everything else except the last two tiles.
*/
for (x = 0, i = n-1; i > 2; i--) {
* Place everything else except the last two tiles.
*/
for (x = 0, i = n-1; i > 2; i--) {
- int k = rand
_upto(
i);
+ int k = rand
om_upto(rs,
i);
int j;
for (j = 0; j < n; j++)
int j;
for (j = 0; j < n; j++)