0.0.3 • Published 5 years ago

fisher-yates-crypto v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

fisher-yates-crypto

Fisher-Yates Shuffle Implementation in JavaScript with default cryptographically strong random number generator. Designed to be a drop-in replacement for Math.random. Can be used with Node or in a browser.

Requirements

  • NodeJS 6+

Installation

npm install fisher-yates-crypto --save

Usage

const shuffleCrypto = require('fisher-yates-crypto')
const deck = ['A', 'B', 'C', 'D']
const shuffledDeck = shuffleCrypto(deck)
const randomizer = function() {
    return 0.6361052929345046
};
const shuffleCrypto = require('fisher-yates-crypto')
const deck = ['A', 'B', 'C', 'D']
const shuffledDeck = shuffleCrypto(deck, randomizer())