Random Latin squares: Difference between revisions

Content added Content deleted
(→‎{{header|F_Sharp|F#}}: the evidence suggests the method is not equivalent to random sampling from the universe)
(→‎{{header|Factor}}: "as per the task description")
Line 823: Line 823:


=={{header|Factor}}==
=={{header|Factor}}==
A brute force method for generating uniformly random Latin squares. 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.
A brute force method for generating random Latin squares as per the task description. 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 ;