@kimmel/array-shuffle
v1.2.1
Published
Fisher-Yates shuffle of an array of items.
Downloads
8
Readme
array-shuffle
Fisher-Yates shuffle of an array of items producing an unbiased permutation.
Install
$ npm install @kimmel/array-shuffle
Usage
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.
API
shuffle(items)
items
Type: array
['hello', 2, 5, { foo: 'bar' }]
License
MIT © Ryan Castner