Random Latin squares: Difference between revisions

Content added Content deleted
m (→‎{{header|jq}}: shuffle)
Line 823:
 
=={{header|Factor}}==
A brute force method for generating random Latin squares aswith uniform randomness perfrom the taskrelevant descriptionpopulation. 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 ;