'use strict'; const { describe, it } = require('node:test'); const assert = require('node:assert/strict'); const Rng = require('../src/rng.js'); describe('Rng', () => { it('is deterministic for the same seed', () => { const a = Rng.create(42); const b = Rng.create(42); const seqA = [a(), a(), a(), a(), a()]; const seqB = [b(), b(), b(), b(), b()]; assert.deepEqual(seqA, seqB); }); it('differs across seeds and stays in [0, 1)', () => { const a = Rng.create(1); const b = Rng.create(2); assert.notEqual(a(), b()); const r = Rng.create(99); for (let i = 0; i < 1000; i++) { const x = r(); assert.ok(x >= 0 && x < 1); } }); it('pickIndex stays inside the range', () => { const r = Rng.create(7); for (let i = 0; i < 200; i++) { const idx = Rng.pickIndex(r, 5); assert.ok(idx >= 0 && idx < 5); } assert.equal(Rng.pickIndex(r, 0), 0); }); });