rejection-sampled-int
Cryptographically random integers, chosen by a rejection sampling algorithm.
Warning: I am not a cryptographer, or any sort of random number expert. An audit would be greatly appreciated.
Installation
To install the module for use in your projects:
npm install rejection-sampled-int
This library includes TypeScript definitions, and should be discovered automatically by the TypeScript compiler.
Usage
var rand = rand // 56rand // 11 // 13 // 10rand // 8882371922968183
API
rand({min = 0, max = Number.MAX_SAFE_INT}, [ready(err, int)])
Get an integer betweenmin
(inclusive) andmax
(exclusive). Ifready
is not provided, aPromise
is returned.rand.sync({min = 0, max = Number.MAX_SAFE_INT})
Get an integer betweenmin
(inclusive) andmax
(exclusive), synchronously.
License
MIT. See LICENSE for details.