Study 05 · simulation integrity

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.

10,000,000
Primary sample
European spins
53.71
χ² statistic
36 df; 5% critical 50.9985
-0.000305
Lag-1 correlation
0.520%
Largest pocket deviation

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.

PocketCountDeviationPocketCountDeviation
0270,3080.014%19269,788-0.178%
1270,5070.088%20270,3020.012%
2270,129-0.052%21269,495-0.287%
3270,5500.103%22271,5370.469%
4271,1090.310%23269,414-0.317%
5270,4510.067%24270,6760.150%
6269,753-0.191%25270,7810.189%
7270,2720.001%26270,267-0.001%
8270,173-0.036%27271,4940.453%
9270,3140.016%28270,9880.266%
10271,0370.284%29269,356-0.338%
11270,9290.244%30270,9190.240%
12269,618-0.241%31269,862-0.151%
13270,7530.179%32269,970-0.111%
14270,3310.022%33269,961-0.114%
15269,545-0.268%34270,112-0.059%
16268,866-0.520%35269,283-0.365%
17269,930-0.126%36271,1560.328%
18270,064-0.076%
Pocket 16
-0.520%
Pocket 22
+0.469%
Pocket 27
+0.453%
Pocket 35
-0.365%
Pocket 29
-0.338%
Pocket 36
+0.328%
Pocket 23
-0.317%
Pocket 4
+0.310%
Pocket 21
-0.287%
Pocket 10
+0.284%
Bar lengths share one scale within this figure. Exact values appear at right.

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.

Audit the numbers.The chart data is checked in as plain CSV; the combined snapshot is also available as JSON.

Sources and implementation references