Returns a new array with elements in a random order (Fisher-Yates shuffle). Pass a custom random function to make the shuffle deterministic in tests.
random
The source array.
RNG function returning [0, 1). Defaults to Math.random.
[0, 1)
Math.random
shuffleArray([1, 2, 3, 4, 5]) // => e.g. [3, 1, 5, 2, 4] Copy
shuffleArray([1, 2, 3, 4, 5]) // => e.g. [3, 1, 5, 2, 4]
Returns a new array with elements in a random order (Fisher-Yates shuffle). Pass a custom
randomfunction to make the shuffle deterministic in tests.