Shuffle an array using
secure-random-uniformas the RNG
npm install secure-shuffle
Note that this module mutates the passed array, as you can always
.slice(0) to get a "cheap" copy:
const sshuffle =const arr = 1 2 3 4 5 6 7 8 9const sarr = // sarr is now a shuffled copy of arr// arr is now shuffled
Takes an array-like structure (eg. Buffer) and shuffles it. Note that the original will be mutated for performance reasons. You might want to copy the structure before passing it, depending on your use-case.
As a convenience, the passed structure will be returned.