C++ mt19937 random generator wrapper for Node.js.
$ npm install --save @crand/mt19937
First you should create an mt19937 Object:
const Mt19937 = require('@crand/mt19937');
const rand = new Mt19937(seed);
Then you can generate random numbers via .next()
:
for (let i = 0; i < 100; i++) {
console.log(rand.next());
}
Constructor of Mt19937
class.
seed
: the random seed (optional);a
: the minimum bound of the random number (default to 0);b
: the maximum bound of the random number (default tostd::numeric_limits<int>::max()
).
Generate next random number.
None.
The random number.
Destroy the generator.
None.
None.
Issues and PRs are welcomed.