The naive shuffle does for (let i = 0; i < n; i++) swap(a[i], a[j]) with j drawn from every position 0 .. n - 1. Instead of running it at random, count it exactly.
Write naiveShuffleCounts(n). Start from the array [0, 1, ..., n - 1] and try every one of the n ** n ways to choose j at each of the n steps. Return an object that maps each resulting array, written as its numbers joined with no separator (for example "102"), to the number of choice sequences that produce it.
1 <= n <= 6 (the biggest case has 46,656 sequences)- Only arrays that can occur appear as keys
- For a fair shuffle all the counts would be equal; here they are not once
n >= 3