9 lines
240 B
Text
9 lines
240 B
Text
Clear[RandomLatinSquare]
|
|
RandomLatinSquare[n_] := Module[{out, ord},
|
|
out = Table[RotateLeft[Range[n], i], {i, n}];
|
|
out = RandomSample[out];
|
|
ord = RandomSample[Range[n]];
|
|
out = out[[All, ord]];
|
|
out
|
|
]
|
|
RandomLatinSquare[5] // Grid
|