RosettaCodeData/Task/Random-Latin-squares/00-TASK.txt
2023-07-01 13:44:08 -04:00

25 lines
1.1 KiB
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

A Latin square of size <code>n</code> is an arrangement of <code>n</code> symbols in an <code>n-by-n</code> square in such a way that each row and column has each symbol appearing exactly once.<br>
For the purposes of this task, a random Latin square of size <code>n</code> is a Latin square constructed or generated by a probabilistic procedure such that the probability of any particular Latin square of size <code>n</code> being produced is non-zero.
;Example n=4 randomised Latin square:
<pre>0 2 3 1
2 1 0 3
3 0 1 2
1 3 2 0</pre>
;Task:
# Create a function/routine/procedure/method/... that given <code>n</code> generates a randomised Latin square of size <code>n</code>.
# Use the function to generate ''and show here'', two randomly generated squares of size 5.
;Note:
Strict ''uniformity'' in the random generation is a hard problem and '''not''' a requirement of the task.
;Related tasks:
* [[Latin Squares in reduced form/Randomizing using Jacobson and Matthews Technique]]
* [[Latin Squares in reduced form]]
;Reference:
* [[wp:Latin_square|Wikipedia: Latin square]]
* [[oeis:A002860|OEIS: A002860]]
<br>