shithub: puzzles

Download patch

ref: aa6fb7507252dec76e2c30ebfdc76b0e366851d7
parent: d68ba4b21e11928fc256caca6d8836ac986848ad
author: Simon Tatham <[email protected]>
date: Mon Feb 19 14:38:00 EST 2007

Forgot to shuffle the num[] array! That was probably introducing
some really subtle probabilistic bias in the generated latin squares.

[originally from svn r7302]

--- a/latin.c
+++ b/latin.c
@@ -1092,6 +1092,7 @@
 	for (j = 0; j < o; j++)
 	    col[j] = num[j] = j;
 	shuffle(col, j, sizeof(*col), rs);
+	shuffle(num, j, sizeof(*num), rs);
 	/* We need the num permutation in both forward and inverse forms. */
 	for (j = 0; j < o; j++)
 	    numinv[num[j]] = j;