Random Latin squares: Difference between revisions

Content added Content deleted
Line 1,686: Line 1,686:
RandomLatinSquare[n_] := Module[{out, ord},
RandomLatinSquare[n_] := Module[{out, ord},
out = Table[RotateLeft[Range[n], i], {i, n}];
out = Table[RotateLeft[Range[n], i], {i, n}];
ord = RandomSample[Range[n]];
out = RandomSample[out];
out = out[[ord]];
ord = RandomSample[Range[n]];
ord = RandomSample[Range[n]];
out = out[[All, ord]];
out = out[[All, ord]];