Const
Creates a mock RNG that returns predefined values in sequence.
IMPORTANT: Throws MockRNGExhaustedError when all values are consumed. This behavior catches incorrect roll counts in tests - it never wraps around.
Array of values to return (dice results for nextInt, floats for next)
RNG instance returning predefined values
const rng = createMockRng([4, 2, 6]);rng.nextInt(1, 6); // Returns 4rng.nextInt(1, 6); // Returns 2rng.nextInt(1, 6); // Returns 6rng.nextInt(1, 6); // Throws MockRNGExhaustedError Copy
const rng = createMockRng([4, 2, 6]);rng.nextInt(1, 6); // Returns 4rng.nextInt(1, 6); // Returns 2rng.nextInt(1, 6); // Returns 6rng.nextInt(1, 6); // Throws MockRNGExhaustedError
Creates a mock RNG that returns predefined values in sequence.
IMPORTANT: Throws MockRNGExhaustedError when all values are consumed. This behavior catches incorrect roll counts in tests - it never wraps around.