The Twiddle shuffling algorithm was theoretically parity-unbalanced:
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 4 May 2005 12:52:51 +0000 (12:52 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 4 May 2005 12:52:51 +0000 (12:52 +0000)
commit4b0cf9034e4e73a42d48326ec6f6fca3023a0661
treeabe353c036ade327d6dfc290cea75c702bbde4fa
parent3101ae2613f66463bd4d3b1fe5a188df1aee3271
The Twiddle shuffling algorithm was theoretically parity-unbalanced:
it performed a fixed number of shuffling moves, and on each one it
had a 2/3 chance of flipping the permutation parity and a 1/3 chance
of keeping it the same. Markov analysis shows that over a run of
1500-odd shuffle moves this will end up being an undetectably small
actual bias in the parity of the generated grid, but it offends my
sense of pedantry nonetheless so here's a small change to make the
number of shuffling moves itself have randomly chosen parity. The
parity of generated grids should now be _exactly_ 50:50.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5742 cda61777-01e9-0310-a592-d414129be87e
twiddle.c