shuffle
Callable
Type parameters
- T
Parameters
xs: Traversable<T, unknown>
The array to shuffle.
random: () => number = Math.random
The random implementation to shuffle
Returns T[]
A new array with the same elements as the original array, but in a random order.
It takes a traversable and returns a new array with the same elements in a random order.
Example