Deterministic RNG design and validation
Frequency, serial-correlation, repeatability, and multi-seed batch checks for the exact two-stage seeded generator used by 0xRoulette.
Reproducible simulation needs two properties that pull in different directions: the output must look uniform enough for the model, and the same seed must always recreate the same sequence. This test exercises the exact two-stage path used by the backtest kernel, not a replacement generator written for the article.
Generator path
Each run starts from a 32-bit seed. The kernel advances a Squirrel3-family mixer to derive a round seed; the wheel creates a fresh mixer from that value and maps its first output into one of 37 pockets. A second, independently seeded stream is reserved for strategy code. The split prevents a strategy’s call to ctx.rng() from advancing the wheel stream.
- Primary seed
0x6d2b79f5- First 20 pockets
26, 30, 20, 33, 31, 27, 20, 7, 21, 22, 25, 27, 17, 28, 1, 35, 11, 5, 15, 3- First 1,000 checksum
515871c2e1075ea7e5c8bb8bcb2040965a9716f4b839943993da4d4e804078f7- Additional batches
- 20 seeds × 1,000,000 spins
What the tests said
The 10-million-spin Pearson statistic was 53.7059, above the 5% critical value of 50.9985. That single sample would reject uniformity at that threshold. We report it instead of swapping seeds. Across 20 separately seeded one-million-spin batches, 0 crossed the same threshold; about one crossing is expected when twenty true-null tests each use a 5% cutoff. The lag-1 correlation was -0.00030506, close to zero at this resolution.
| Count | Deviation | Count | Deviation | ||
|---|---|---|---|---|---|
| 0 | 270,308 | 0.014% | 19 | 269,788 | -0.178% |
| 1 | 270,507 | 0.088% | 20 | 270,302 | 0.012% |
| 2 | 270,129 | -0.052% | 21 | 269,495 | -0.287% |
| 3 | 270,550 | 0.103% | 22 | 271,537 | 0.469% |
| 4 | 271,109 | 0.310% | 23 | 269,414 | -0.317% |
| 5 | 270,451 | 0.067% | 24 | 270,676 | 0.150% |
| 6 | 269,753 | -0.191% | 25 | 270,781 | 0.189% |
| 7 | 270,272 | 0.001% | 26 | 270,267 | -0.001% |
| 8 | 270,173 | -0.036% | 27 | 271,494 | 0.453% |
| 9 | 270,314 | 0.016% | 28 | 270,988 | 0.266% |
| 10 | 271,037 | 0.284% | 29 | 269,356 | -0.338% |
| 11 | 270,929 | 0.244% | 30 | 270,919 | 0.240% |
| 12 | 269,618 | -0.241% | 31 | 269,862 | -0.151% |
| 13 | 270,753 | 0.179% | 32 | 269,970 | -0.111% |
| 14 | 270,331 | 0.022% | 33 | 269,961 | -0.114% |
| 15 | 269,545 | -0.268% | 34 | 270,112 | -0.059% |
| 16 | 268,866 | -0.520% | 35 | 269,283 | -0.365% |
| 17 | 269,930 | -0.126% | 36 | 271,156 | 0.328% |
| 18 | 270,064 | -0.076% |
Limitations: what this does not prove
Frequency and serial-correlation checks are narrow diagnostics. They do not establish cryptographic security, unpredictability, or freedom from every higher-order pattern. This generator is intentionally deterministic and must not secure money, secrets, or real gambling. The checksum is a regression fixture: if engine output changes, the published sequence should change visibly and trigger review.
Sources and implementation references
- NIST SP 800-22 Rev. 1a, A Statistical Test Suite for Random and Pseudorandom Number Generators.
- 0xRoulette engine implementation snapshot, generated and reviewed 2026-08-15.