// written in the D programming language import std.algorithm; import std.array; import std.random; import std.range; import std.stdio; void main () { immutable int n = 4; immutable int steps = 10_100 * n ^^ n; int [n] p; int [int [n]] d; foreach (step; 0..steps) { p[] = n.iota.array; foreach (i; 0..n) { int j = uniform (0, n); swap (p[i], p[j]); } d[p] += 1; } writefln ("%(%s %s\n%)", d); }
Standard input is empty
[0, 2, 1, 3] 101017 [0, 1, 3, 2] 101144 [1, 0, 3, 2] 151325 [3, 0, 1, 2] 81097 [3, 2, 0, 1] 101275 [2, 3, 0, 1] 110811 [1, 2, 3, 0] 141461 [0, 1, 2, 3] 101129 [2, 1, 0, 3] 90904 [3, 1, 0, 2] 91372 [0, 2, 3, 1] 141320 [3, 2, 1, 0] 100997 [0, 3, 2, 1] 91327 [3, 0, 2, 1] 90743 [3, 1, 2, 0] 80384 [0, 3, 1, 2] 111424 [2, 0, 1, 3] 111194 [1, 3, 2, 0] 110692 [1, 3, 0, 2] 110917 [2, 3, 1, 0] 100812 [1, 2, 0, 3] 141214 [2, 1, 3, 0] 111493 [2, 0, 3, 1] 111077 [1, 0, 2, 3] 100471