shuffle
shuffle<
T
>(xs
,random
):T
[]
It takes a traversable and returns a new array with the same elements in a random order.
Example
shuffle([1, 2, 3])// => [2, 3, 1]
shuffle([1, 2, 3])// => [2, 1, 3]
Type Parameters
• T
Parameters
xs
Iterable
<T
>
The array to shuffle.
random
() => number
The random implementation to shuffle
Returns
T
[]
A new array with the same elements as the original array, but in a random order.