secure-chance
Create an instance of Chance with a truly random seed.
Install
npm install secure-chance
Why
Chance currently uses a Mersenne Twister seeded by Math.random()
for randomness.
The problem with this is that Math.random()
is not cryptographically secure as it was never required in the specification.
secure-chance
fixes this issue by generating a random seed using quantum randomness provided by qrng.anu.edu.au with a fallback to secure offline methods like the Node.js Crypto API or the Web Crypto API.
Usage
const secureChance = const chance = await chancechance
API
secureChance()
Returns a promise which resolves with an instance of Chance.