RNG statistical testing in iGaming investigates whether an observed sequence is consistent with the mathematical behavior expected from a specified random process. It is a diagnostic tool, not a device for declaring any generator “truly random,” secure or approved. A weak generator can occasionally produce samples that look statistically plausible. A sound generator can occasionally fail a test at the prescribed false-positive rate. Neither outcome should be interpreted without the null hypothesis, sample size, preprocessing and test plan.
Casino engineering introduces a second challenge: the output of the random-bit generator is not necessarily the same thing as the final game outcome. A generator might produce apparently uniform bits while a faulty conversion to reel stops or card indices introduces bias. Conversely, a game payout distribution is generally not uniform: many outcomes deliberately occur with very different theoretical frequencies. Test the correct layer against its correct expected distribution.

Test objective, null hypotheses and assumptions
A test begins with an explicit null hypothesis. For six intended equally likely outcome categories, the null may state that each category has probability 1/6. For a binary stream, another test might state that samples behave as independent Bernoulli trials with probability 1/2. These are different propositions. Passing a test of equal counts does not establish the independence of successive observations; passing a serial test does not establish the absence of a subtle marginal bias.
Define the measured object before collecting data. Is the sample raw entropy-source output, post-conditioned bits, a deterministic RNG stream, scaled integers, actual game outcomes or payout amounts? Record the generator build, initialization procedure, seed or reseed policy (without disclosing operational secrets), collection path and any discarded values. A production sampling procedure that cherry-picks “good periods” or silently drops invalid records changes the statistical question.
NIST SP 800-22 Rev. 1a describes a suite of statistical methods for random and pseudorandom bits. NIST SP 800-90B deals with assessment of entropy sources, which is a different layer of analysis. Neither document says that passing any arbitrary set of output tests proves a generator’s cryptographic unpredictability. Licensing and test-house rules may define additional requirements and formats.

Sample size, preprocessing and independence
Sample size determines which effect sizes a test can detect reliably. A tiny sample can miss meaningful bias; an enormous sample can flag a small deviation that is statistically detectable but must still be evaluated in the product’s operational context. Estimate power for plausible defects before setting a sample count, especially for rare game outcomes. State whether the sample comprises independent observations, repeated seeded runs, several machines or one continuous stream.
Preprocessing must be specified. If you convert bytes to six categories with naive modulo reduction, the mapping may generate nonuniform outcomes even when the source bytes are uniform. Test the raw generator separately from the mapping. If there are known discarded values, count and explain them. If the collection system batches, sorts, filters or deduplicates observations, document the impact on serial structure; seemingly harmless reordering can destroy the very dependence the test is intended to observe.
When a deterministic pseudorandom generator is initialized repeatedly with the same seed, the resulting streams may be identical. Pooling their counts and treating them as new independent evidence is pseudoreplication. Keep seed identity, sample boundaries, environment and generator configuration alongside results. Repeated test executions should be reproducible for debugging yet appropriately varied when evaluating a stochastic source. The lab’s approved plan determines when and how that distinction is implemented.
Independence is best addressed through multiple diagnostics matched to realistic failure modes: serial correlation, repetition, periodicity, runs structure and cross-stream overlap where applicable. A stream with equal zeros and ones may still be highly predictable. The simple worked example below deliberately illustrates that pitfall.
Uniformity tests and goodness-of-fit
A Pearson chi-square goodness-of-fit test compares observed counts with counts expected under a categorical distribution. If six symbols are intended to be equally likely and 60,000 outcomes are collected, each symbol’s expected count is 10,000. The statistic is the sum of (observed - expected)^2 / expected across the categories. Under appropriate assumptions and when parameters are not estimated from the same data, a common reference distribution has five degrees of freedom.
In the illustrative synthetic sample generated with NumPy default_rng(20261123), the six counts were 10,162; 9,966; 9,952; 9,914; 10,016; and 9,990. The corresponding chi-square statistic is approximately 3.7456, with a p-value of 0.5866. These observations do not provide evidence against the specified equal-probability null at a conventional 5% threshold. They also do not prove the generator is unbiased in all circumstances or suitable for real-money deployment.

For nonuniform game outcomes, replace equal counts with the probabilities in the actual approved model. A chi-square test on rare categories may need regrouping or a different exact or simulation-based method because expected-count assumptions can break down. Do not regroup after inspecting the observed failures merely to obtain a favorable p-value. When the model has estimated parameters, adjust the testing procedure and degrees of freedom accordingly.
For continuous variables, tests such as Kolmogorov–Smirnov or distribution-specific alternatives may be appropriate, but they are not universal plug-ins for arbitrary mapped game results. Test design should follow the value type, dependency structure, sample size and failure modes. No single goodness-of-fit number captures a game’s complete mathematical integrity.
Runs, correlation and sequential tests
The runs test examines the grouping of successive symbols. For a binary stream, a run is a consecutive block of identical values, such as 000 or 11. Under an appropriate independent binary model, the number of runs has a calculable expectation and variance conditional on the numbers of zeros and ones. Too few runs can indicate clustering; too many can indicate alternation. Correlation at lag 1 offers a complementary view of adjacent observations, although correlations of zero do not guarantee independence at every lag or order.
Our synthetic comparison makes the distinction concrete. An independent generated bitstream of 10,000 bits had 5,006 ones, 5,029 runs and lag-one correlation approximately −0.0057. Its approximate two-sided runs-test p-value was 0.5754. A second stream was constructed by generating 10,000 source bits and repeating each bit twice, giving a 20,000-bit sequence. Its zero/one balance remained roughly even, but it had only 5,001 runs compared with about 10,000.26 expected for independent bits and lag-one correlation near 0.50. Its runs-test statistic was about −70.7, giving a p-value too small to represent meaningfully as an ordinary decimal.

The deliberately duplicated-bit example illustrates a specific construction defect, not an estimate of real iGaming generator performance. An evaluator should also consider lag-k correlations, periodicity, restarts and cross-stream checks where relevant. Multiple views can identify different patterns. Passing several tests increases confidence in observed behavior under the tested conditions but still cannot make a finite sample a proof of unpredictability.
Sequential tests and continuous monitoring need predeclared decision rules. Repeatedly checking a p-value every few seconds and stopping on the first small value changes the false-alarm probability unless the method explicitly accounts for sequential looks. An operational health test for an entropy source may have a different purpose and required calibration from a one-time statistical assessment of a finalized game RNG build. Do not substitute one for the other without analysis.
p-values, multiple testing and interpretation
A p-value is the probability, under a specified null and test assumptions, of observing a test statistic at least as extreme as the one observed. It is not the probability the RNG is good; it is not the probability the null is true. At a 5% significance level, even a well-behaved source can produce false rejections. Investigate failures rather than merely rerun until the dashboard turns green.
A battery of tests produces multiple p-values, and naïve interpretation can inflate false-positive conclusions. If ten independent true null tests each use alpha 0.05, the chance of at least one false rejection is 1 - 0.95^10, or approximately 40.1%. Real test statistics may be dependent, so that number is an illustration of the general problem, not a prediction for a specific NIST test suite. Use an agreed family-wise or false-discovery control strategy, or an explicitly documented test-battery decision procedure, and report all tests rather than only favorable ones.

For a more complete assessment, look at the distribution of p-values across many truly independent sequences and check the proportion of sequences passing each test as prescribed by the chosen methodology. Predefine sample sizes, parameter estimation rules, thresholds and data exclusions. If the output reveals a pattern linked to reseeding, device temperature or system restart, preserve the context; average values from unrelated conditions can conceal operational faults.
A small p-value deserves diagnosis: first verify collection and parsing, then verify the null assumptions, then inspect the implementation or source. A large p-value deserves equally disciplined language: “did not reject in this sample” is defensible, whereas “proved random and fair” is not. Fairness further depends on correct outcome mapping, game rules, payout mathematics and operational integrity.
Test report example and known limitations
A minimal reproducible report should include the following fields: system and version under test; data source and collection location; sampling and seeding strategy; mathematical hypothesis; preprocessing and exclusions; test implementation version; sample size; statistic; degrees of freedom or other reference details; p-value and threshold; multiple-testing procedure; deviations; environmental observations; and reviewer decision. Preserve a hash of the underlying sample so later analysts can distinguish altered data from altered code.
Here is an abbreviated non-certification research example from our synthetic data:
| Diagnostic | Synthetic setup | Result | Interpretation |
|---|---|---|---|
| Categorical uniformity | Six categories, 60,000 draws | χ² = 3.7456; p = 0.5866 | No rejection of specified equal frequencies |
| Runs test, IID example | 10,000 generated bits | 5,029 runs; p ≈ 0.5754 | No rejection under the stated approximation |
| Runs test, paired example | 10,000 bits repeated twice | 5,001 runs; z ≈ −70.7 | Strong rejection of independence assumption |
| Lag-1 correlation, paired | Adjacent bits | r ≈ 0.50 | Obvious serial dependence |
The accompanying rng-synthetic-test-results.csv records the generated numerical summary and seed. This example is designed to demonstrate why uniformity and independence are separate questions; it is not a test of a real casino platform, a certified RNG or a production entropy source.
The biggest limits are methodological. A finite output sequence cannot establish future unpredictability; a correct-looking bitstream cannot establish unbiased game mapping; a mathematically correct model cannot establish secure deployment; and a statistically satisfactory run cannot grant regulatory approval. Combine diagnostic statistics with construction review, source-health assessment, implementation and mapping verification, versioned test evidence and the actual jurisdiction’s testing procedure. Keep the claims narrow enough that the evidence truly supports them.