mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Forgot to shuffle the num[] array! That was probably introducing
some really subtle probabilistic bias in the generated latin squares. [originally from svn r7302]
This commit is contained in:
1
latin.c
1
latin.c
@ -1092,6 +1092,7 @@ digit *latin_generate(int o, random_state *rs)
|
|||||||
for (j = 0; j < o; j++)
|
for (j = 0; j < o; j++)
|
||||||
col[j] = num[j] = j;
|
col[j] = num[j] = j;
|
||||||
shuffle(col, j, sizeof(*col), rs);
|
shuffle(col, j, sizeof(*col), rs);
|
||||||
|
shuffle(num, j, sizeof(*num), rs);
|
||||||
/* We need the num permutation in both forward and inverse forms. */
|
/* We need the num permutation in both forward and inverse forms. */
|
||||||
for (j = 0; j < o; j++)
|
for (j = 0; j < o; j++)
|
||||||
numinv[num[j]] = j;
|
numinv[num[j]] = j;
|
||||||
|
Reference in New Issue
Block a user