Reproducible random values using the Merseene Twister algorithm. With the same seed value, it produces the same series of random values.
// Seed with a value of 100const r = mersenneTwister(100);r.float(); // 0..1 Copy
// Seed with a value of 100const r = mersenneTwister(100);r.float(); // 0..1
Integer values can also be produced. First parameter is the maximum value (exclusive), the optional second parameter is the minimum value (inclusive).
r.integer(10); // 0..9r.integer(10, 5); // 5..9// Eg random array index:r.integer(someArray.length); Copy
r.integer(10); // 0..9r.integer(10, 5); // 5..9// Eg random array index:r.integer(someArray.length);
Adapted from George MacKerron's implementation. MIT License. https://github.com/jawj/mtwist/
Optional
Seed value 0..4294967295. Default: random seed.
Reproducible random values using the Merseene Twister algorithm. With the same seed value, it produces the same series of random values.
Integer values can also be produced. First parameter is the maximum value (exclusive), the optional second parameter is the minimum value (inclusive).
Adapted from George MacKerron's implementation. MIT License. https://github.com/jawj/mtwist/