Fisher-Yates shuffle of an array of items producing an unbiased permutation.
$ npm install @kimmel/array-shuffle
import shuffle from '@kimmel/array-shuffle';
const shuffledArray = shuffle([1, 2, 3, 4, 5, 6]);
//=> [3, 1, 2, 5, 6, 4]
shuffle
does not mutate the original array.
Type: array
['hello', 2, 5, { foo: 'bar' }]
MIT © Ryan Castner