Package Exports
- @grandom/mt19937
- @grandom/mt19937/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@grandom/mt19937) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@grandom/mt19937
Configurable Mersenne Twister PRNG implementation written in TypeScript.
Install
npm i @grandom/mt19937Usage
import MT19937 from '@grandom/mt19937'
// create a new MT19937 instance with seed 12345
const random = new MT19937(12345)
// a random integer in range [0, 4294967295]
// use this for common random integer generation
const randomInt32 = random.randomInt32()
// a random integer in range [0, 2147483647]
const randomInt31 = random.randomInt31()
// a random float in range [0.0, 1.0]
const randomFloat1 = random.randomFloat1()
// a random float in range [0.0, 1.0) - same as Math.random()
// use this for common random float generation
const randomFloat2 = random.randomFloat2()
// a random float in range (0.0, 1.0)
const randomFloat3 = random.randomFloat3()
// a random float in range [0.0, 1.0) with 53-bit resolution.
const randomFloatRes53 = random.randomFloatRes53()