Random Latin squares: Difference between revisions

→‎{{header|Factor}}: "as per the task description"
(→‎{{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:
 
=={{header|Factor}}==
A brute force method for generating uniformly 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
prettyprint random sequences sets ;
2,442

edits