fisher-yates-shuffle-js
v1.0.0
Published
Implementation of Fisher-Yates shuffle algorithm in JavaScript
Downloads
1
Maintainers
Readme
Shuffle
This is implementation of the Fisher-Yates shuffle algorithm in JavaScript. It's puts all items of given array in random order.
Installation
npm install fisher-yates-shuffle-js
Usage
const shuffle = require ('fisher-yates-shuffle-js');
var exampleArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var shuffledArray = shuffle (exampleArray);
console.log (shuffledArray)
Example output:
[
5, 7, 10, 9, 4,
3, 2, 1, 6, 8
]