Random Latin squares: Difference between revisions
Content added Content deleted
m (→{{header|jq}}: shuffle) |
(→{{header|Factor}}: uniformity) |
||
Line 823: | Line 823: | ||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
A brute force method for generating |
A brute force method for generating Latin squares with uniform randomness from the relevant population. Repeatedly select a random permutation of (0, 1,...n-1) and add it as the next row of the square. If at any point the rules for being a Latin square are violated, start the entire process over again from the beginning. |
||
<syntaxhighlight lang="factor">USING: arrays combinators.extras fry io kernel math.matrices |
<syntaxhighlight lang="factor">USING: arrays combinators.extras fry io kernel math.matrices |
||
prettyprint random sequences sets ; |
prettyprint random sequences sets ; |