export class SeededRandom {
    state;
    constructor(seed) {
        if (!Number.isInteger(seed))
            throw new RangeError("Seed must be an integer.");
        this.state = seed >>> 0;
    }
    nextUint32() {
        let x = this.state;
        x ^= x << 13;
        x ^= x >>> 17;
        x ^= x << 5;
        this.state = x >>> 0;
        return this.state;
    }
    nextFloat() {
        return this.nextUint32() / 0x1_0000_0000;
    }
    range(min, max) {
        if (min > max)
            throw new RangeError("min must be <= max");
        return min + (max - min) * this.nextFloat();
    }
    clone() {
        const random = new SeededRandom(0);
        random.state = this.state;
        return random;
    }
}
//# sourceMappingURL=Random.js.map