Randomly shuffles an array using the Fisher-Yates algorithm. Returns a new array and does not mutate the original.
The array to shuffle.
A new, randomly ordered array.
shuffle([1, 2, 3, 4, 5]) // e.g., [3, 5, 1, 4, 2] Copy
shuffle([1, 2, 3, 4, 5]) // e.g., [3, 5, 1, 4, 2]
Randomly shuffles an array using the Fisher-Yates algorithm. Returns a new array and does not mutate the original.