Constructor
new LCG(seed)
Implements the LCG algorithm to generate pseudorandom numbers.
This class provides the LCG algorithm for generating psuedorandom numbers to the PRNG class.
Parameters:
Name | Type | Description |
---|---|---|
seed |
number | The seed value for the LCG PRNG. |
- Implements:
- Source:
- See:
Example
const rng = new LCG(123456789);
console.log(rng.next()); // Generates a pseudorandom number
Classes
- LCG
Implements the LCG algorithm to generate pseudorandom numbers.
Methods
next() → {number}
Generates the next pseudorandom number.
Returns:
A number in the range [0 to this.modulus - 1).
- Type
- number