Fisher-Yates Shuffle
A JavaScript implementation of the Fisher-Yates Shuffle algorithm.
Requirements
- NodeJS 6+
Installation
npm install fisher-yates-shuffle --save
Usage
const shuffle = ;const deck = 'a' 'b' 'c' 'd';const shuffledDeck = ;
const randomizer = { return 0321};const shuffle = ;const deck = 'a' 'b' 'c' 'd';const shuffledDeck = ;
Notes
- It clones the given
Array
, so if it's rather large, make sure you have enough memory allocated. - This library is still rather naïve and could be improved. If you have any suggestions, please open up an Issue or a Pull Request.