The seed to initialise the state of the generator.
The seed to initialise the sequence number of the generator.
The sequence number of the generator.
The internal state of the generator.
Advances the internal state of the generator delta
steps. Delta can be
negative to reverse.
This is calculated in a very similar way to the square and multiply method for taking the power of a number. As you may expect, it is calculated in log(delta) time.
This is the source of randomness for all other random methods.
Produces a uniformly distributed 32-bit unsigned integer as a bigint.
Although the produced number is 32 bits; the implementation requires that the state of the generator be a 64 bit unsigned integer. Since the js Number datatype cannot reliably handle integers that large, we use the BigInt class for the calculation.
Produces a uniformly distributed integer, r, with 0 ≤ r < bound.
To produce a uniformly distributed integer in the range [low, high):
const i = low + rand.randint(high - low)
The lower bound for the number.
Generates an approximately uniformly distributed number, r, with 0 ≤ r < 1.
The number r.
Generated using TypeDoc
A PRNG class. Provides two main methods:
random
- Produces a "continuous" standard uniform distribution.randint
- Produces a discrete uniform distribution.For more details, check the individual methods.