shuffle-x
Creates an array of shuffled values.
module.exports(array)
⇒ Array
⏏
Creates an array of shuffled values.
Kind: Exported function
Returns: Array
- Returns the new shuffled array.
Throws:
-
TypeError
If array is null or undefined.
See: https://en.wikipedia.org/wiki/Fisher-Yates_shuffle
Param | Type | Description |
---|---|---|
array |
Array | Object
|
The array to shuffle. |
Example
import shuffle from 'shuffle-x';
console.log(shuffle([1, 2, 3, 4])); // e.g. [4, 1, 3, 2]