Random Latin squares: Difference between revisions

Content added Content deleted
(→‎{{header|jq}}: all can be generated)
Line 1,572: Line 1,572:
generate LS(20) takes from about 0.36 to 0.94 seconds; and LS(30)
generate LS(20) takes from about 0.36 to 0.94 seconds; and LS(30)
about 0.5 to 29 seconds. The example of LS(40) shown below took 12 seconds (u+s) to generate.
about 0.5 to 29 seconds. The example of LS(40) shown below took 12 seconds (u+s) to generate.

The algorithm will evidently generate every Latin Square of any order eventually, but it's not obvious
how far from uniform the distribution might be, so it is perhaps reassuring to know that on a first attempt,
a run in which 5,760 squares of order 4 were generated did in fact generate all 576 members of LS(4).


The program presented here used /dev/random as its source of entropy.
The program presented here used /dev/random as its source of entropy.