array-prototype-shuffle
v1.0.1
Published
Array prototype shuffle helpers
Maintainers
Readme
array-prototype-shuffle
Installation
npm install array-prototype-shuffleUsage
import "array-prototype-shuffle"
// or require("array-prototype-shuffle")
typeof Array.prototype.shuffle // function
typeof Array.prototype.shuffleUnmodified // function
typeof Array.prototype.shuffleCrypto // function
typeof Array.prototype.shuffleCryptoUnmodified // function
let arr = ["hello", "world", "foo", "bar"]
console.log(arr.shuffle()) // ["world", "bar", "foo", "hello"]
console.log(arr) // ["world", "bar", "foo", "hello"]
arr = ["hello", "world", "foo", "bar"]
console.log(arr.shuffleUnmodified()) // [ 'hello', 'foo', 'bar', 'world' ]
console.log(arr) // ["hello", "world", "foo", "bar"] (Not touched)
arr = ["hello", "world", "foo", "bar"]
console.log(arr.shuffleCrypto()) // [ 'bar', 'world', 'foo', 'hello' ]
console.log(arr) // [ 'bar', 'world', 'foo', 'hello' ]
arr = ["hello", "world", "foo", "bar"]
console.log(arr.shuffleCryptoUnmodified()) // [ 'foo', 'hello', 'world', 'bar' ]
console.log(arr) // ["hello", "world", "foo", "bar"] (Not touched)
// They dont take any function parameters