2.0.0 • Published 4 years ago

secure-chance v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

secure-chance Travis CI Build Status

Create an instance of Chance with a truly random seed.

NPM Badge

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 = require("secure-chance")
const chance = await secureChance()

chance.integer({ min: -20, max: 20 })
chance.string({ length: 5 })

API

secureChance()

Returns a promise which resolves with an instance of Chance.

2.0.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.0

5 years ago