nextInt rejects a scripted value outside the requested [min, max]
with a RangeError, so createMockRng([7]) cannot satisfy a d6.
Both are the only failures that reach a caller of roll() without a
roll-parser code, and only ever when a mock was injected — see
MockRNGExhaustedError for why they stay outside the hierarchy.
Draw order matters when the notation contains meta-expressions. Keep/drop
counts (4d6kh(1d2)) are drawn before the pool; threshold expressions
(4d6cs>(1d2)) are drawn after it. The README's Randomness section has
the full tables.
Parameters
values: number[]
Values to return, in draw order (die faces for nextInt,
floats in [0, 1) for next)
Creates a mock RNG that hands out predefined values in order — the way to write dice tests with exact expected totals.
Two deliberate strictnesses, both there to surface a miscounted sequence instead of hiding it:
nextIntrejects a scripted value outside the requested[min, max]with aRangeError, socreateMockRng([7])cannot satisfy ad6.Both are the only failures that reach a caller of
roll()without a roll-parsercode, and only ever when a mock was injected — see MockRNGExhaustedError for why they stay outside the hierarchy.Draw order matters when the notation contains meta-expressions. Keep/drop counts (
4d6kh(1d2)) are drawn before the pool; threshold expressions (4d6cs>(1d2)) are drawn after it. The README's Randomness section has the full tables.