/** Deterministic pseudo-random generator with configurable seed. */
export class SeededRandom
{
    private seed: number;

    constructor(seed: number)
    {
        this.seed = seed;
    }

    /** Returns the next pseudo-random value in the [0,1) range. */
    next(): number
    {
        this.seed = ((this.seed * 9301) + 49297) % 233280;

        return this.seed / 233280;
    }

    /**
     * Returns the next integer in the provided inclusive range.
     * @param min
     * @param max
     */
    nextInt(min: number, max: number): number
    {
        return Math.floor(this.next() * (max - min + 1)) + min;
    }
}
