wild-inter.net

Random shuffle

Put the entries of an array into a uniformly random order, using n calls to randomInt. Follow a single run step by step, watch the frequencies of many random runs, or count exactly which sequences of random draws lead to which ordering, or watch the frequencies of many random runs.

Algorithm
– / – Speed
The array and the random draws
drawn value of r value not possible in this iteration die face with no pips = 0
What just happened
Pseudocode
Cost of this run
  • calls to randomInt0
  • swaps executed0
  • … of which swap A[i] with itself0
  • draws so far–
Prepared input (text format)
One key = value per line; # starts a comment; every line is optional.
n = 5 — array size (2 … 7).
A = 1 2 3 4 5 — the array contents (distinct entries; this also sets n).
r = 4 2 3 4 4 — the numbers returned by randomInt, one per iteration; omit to draw them at random.
variant = my or variant = kfy — which of the two procedures to run.
mode = run, sample or exactmode = run or sample — which tab to open after loading (default run).
view = bars or view = patterns — the view in the exact tab.
step = 6 — open the single run at this step, or (with view = patterns) with this many patterns placed.
← / → step · Home / End jump to start / end · space plays · drag the grey handles to resize the drawing