Skip to content

Conversation

@edloidas
Copy link
Owner

@edloidas edloidas commented Jan 1, 2026

Add seedable random number generator for deterministic dice rolling:

  • RNG interface with next() and nextInt(min, max) methods
  • SeededRNG class using xorshift128 algorithm with splitmix32 seeding
  • MockRNG factory for deterministic testing (throws on exhaustion)
  • Comprehensive test suite (45 tests) covering:
    • Reproducibility with string/number seeds
    • Edge cases: negative, float, NaN, Infinity, unicode seeds
    • Distribution uniformity for d6, d20, d100
    • Bounds validation (10K+ iterations)
    • Sequence consistency

Key features:

  • Unbiased distribution via rejection sampling
  • nextInt(min, max) returns inclusive bounds [min, max]
  • MockRNG never wraps - catches incorrect roll counts in tests

Add seedable random number generator for deterministic dice rolling:

- RNG interface with next() and nextInt(min, max) methods
- SeededRNG class using xorshift128 algorithm with splitmix32 seeding
- MockRNG factory for deterministic testing (throws on exhaustion)
- Comprehensive test suite (45 tests) covering:
  - Reproducibility with string/number seeds
  - Edge cases: negative, float, NaN, Infinity, unicode seeds
  - Distribution uniformity for d6, d20, d100
  - Bounds validation (10K+ iterations)
  - Sequence consistency

Key features:
- Unbiased distribution via rejection sampling
- nextInt(min, max) returns inclusive bounds [min, max]
- MockRNG never wraps - catches incorrect roll counts in tests
@edloidas edloidas merged commit 677cafb into master Jan 1, 2026
8 checks passed
@edloidas edloidas linked an issue Jan 1, 2026 that may be closed by this pull request
7 tasks
@edloidas edloidas deleted the claude/review-issues-UyC99 branch January 2, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement seedable RNG system

3 participants