The house keeps an edge on every game. No staking system removes it.

18+Adults only

How RNG statistical tests such as chi-square work

A chi-square test counts how often each outcome appeared, compares those counts with what a fair generator would produce, and adds up the squared gaps. A small total fits chance; a large one signals bias. Passing never proves a game is cheap for the player, only that its output looks random.

Why statistics are used on a generator

A random number generator cannot be inspected by looking at one result. A single roulette spin of 17 or a single crash round that stops at 1.20x tells a reader nothing about the mechanism that produced it.

What can be checked is the long record. If the generator is meant to choose each of 37 roulette pockets with equal probability, then over a very large number of spins each pocket should appear close to one thirty-seventh of the time. Statistical tests turn that idea into a number with a rule for reading it.

In Kenya, regulation 45(2) of the Conduct of Gambling Operations Regulations, 2026 says the generator used for all games of chance shall be certified by the Authority or its approved agent "to statistically test the randomness, theoretical return to player". The wider process is described in the guide to how RNG testing and certification work in Kenya. This guide covers the arithmetic of one common test.

The chi-square goodness-of-fit test in four steps

The NIST Engineering Statistics Handbook defines the test statistic as the sum, over all categories, of (O - E) squared divided by E, where O is the observed count and E the expected count. The steps below follow that definition.

  1. State the rule being tested. For example: each of six outcomes has probability 1/6.
  2. Work out expected counts. Expected count = number of trials multiplied by the probability of that outcome.
  3. Compute each contribution. Take observed minus expected, square it, divide by expected.
  4. Add the contributions and compare. The total is compared with a critical value for the chosen significance level and degrees of freedom. NIST states the rule as: reject the hypothesis of a fit if the statistic exceeds that critical value.

NIST gives the degrees of freedom as k minus c, where k is the number of categories and c is the number of estimated parameters plus one. When nothing is estimated from the data, c is 1, so six categories give 5 degrees of freedom.

Worked example with a six-outcome generator

Illustrative example. A generator is meant to return digits 1 to 6 with equal probability. In 600 draws, the expected count for each digit is 600 x 1/6 = 100.

DigitObserved (O)Expected (E)O - E(O - E)² / E
194100-60.36
210810080.64
310110010.01
487100-131.69
5110100101.00
610010000.00
Total60060003.70

The statistic is 0.36 + 0.64 + 0.01 + 1.69 + 1.00 + 0.00 = 3.70, with 6 - 1 = 5 degrees of freedom. A chi-square distribution with 5 degrees of freedom has an average value of 5, so 3.70 is an ordinary result for a fair generator.

Now a second batch of 600 draws.

DigitObserved (O)Expected (E)O - E(O - E)² / E
170100-309.00
2128100287.84
395100-50.25
410510050.25
5112100121.44
690100-101.00
Total600600019.78

The total is 9.00 + 7.84 + 0.25 + 0.25 + 1.44 + 1.00 = 19.78, almost four times the average for 5 degrees of freedom. A tester would compare it with a critical value from a published table, such as those the NIST handbook provides, to decide whether to reject the fair-generator hypothesis for this batch.

Squaring is what makes one large gap (digit 1 at -30) count far more than several small ones. Division by E keeps the scale comparable whether the expected count is 100 or 10,000.

What the test does not see

Chi-square only counts. It ignores the order in which results arrive, so a generator that cycles 1, 2, 3, 4, 5, 6 forever scores exactly 0.00 and is still completely predictable.

That is why a test suite combines several checks, each aimed at a different weakness. The table lists the kinds of question involved. These are general descriptions of method, not a list of what any Kenyan laboratory runs.

QuestionWhat it looks forChi-square alone?
Are outcomes evenly spread?Bias toward some valuesYes, this is its job
Does one result predict the next?Correlation between neighbouring valuesNo, needs pair or serial counts
Are there runs that are too long or too short?Streak patternsNo, needs a runs test
Does the output repeat after a fixed length?Short cyclesNo

One extension is a chi-square on pairs: count each of the 36 two-digit combinations (1 then 1, 1 then 2, and so on) and compare each with its expected share. That catches the cycling generator above, because most pairs would never occur.

Sample size and false alarms

A test run at a 5% significance level will, by design, flag about 1 in 20 perfectly fair batches. A single flagged batch is therefore a reason to test more, not proof of a fault. Testers repeat the check on fresh output and look at whether failures keep coming.

The reverse also holds. A statistic near zero batch after batch is as improbable for genuine randomness as one that strays too far. In the six-digit example a statistic of exactly 0 needs every count to equal 100, which is rare for 600 real random draws.

Sample size matters in both directions. With 12 draws the expected count is only 2 per digit, and the usual chi-square approximation is unreliable. With millions of draws, a tiny real bias becomes visible. The first fact is why one player's few hundred rounds say little, as the guide to theoretical RTP versus short-session results shows from the return side.

Randomness is not the same as a fair price

A generator that passes every test can still sit under a game with a house edge, because the edge comes from the paytable, not from bias in the numbers. A fair wheel paying 35 to 1 on a 1-in-37 pocket returns 36/37 of stakes on average, about 97.3%, whatever the test says about the wheel.

Regulation 45(3) deals with that second question: game rules are evaluated or certified annually and the theoretical return to player percentage for each game is disclosed. Randomness testing and return verification are separate checks on separate parts of a game.

A passed test also gives no hint about the next round. Independent outcomes carry no memory, which is the subject of the guide to the gambler's fallacy and session limits.

Who runs these tests

Form 11 of the Licensing Regulations, 2026 is the application for a gambling equipment testing licence. Its scope list includes "RNG Evaluation & Certification" and "Payout Percentage Verification", and it asks the applicant to describe "testing protocols, statistical models, and reference to international standards". The form does not name a particular statistical test, so this guide does not claim that any specific test is mandatory. The licence itself is explained in the guide to the gambling equipment testing licence.

Questions and answers

What does a chi-square test check in a casino RNG?

It checks whether the counts of each outcome, such as each roulette pocket or each digit, match the counts expected if every outcome had its stated probability. It looks at frequencies only, not at the order of results.

Can a generator pass a chi-square test and still be flawed?

Yes. A sequence that repeats 1, 2, 3, 4, 5, 6 in order has perfectly even counts and a chi-square value of zero, yet it is entirely predictable. This is why testing uses several different tests.

Does a very low chi-square value mean the RNG is excellent?

Not necessarily. Genuine random output varies, so counts that match expectation too neatly are themselves unusual. Testers look at both ends of the distribution.

What do Kenyan regulations say about statistical testing?

Regulation 45(2) of the Conduct of Gambling Operations Regulations, 2026 says the random number generator used for all games of chance shall be certified by the Authority or its approved agent to statistically test the randomness, theoretical return to player.

Can a player run these tests on their own results?

The arithmetic is simple, but a handful of rounds is far too few. Expected counts need to be reasonably large for the method to work, and one person's records rarely reach that size. A result from a small sample says very little.

Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods, Chi-Square Goodness-of-Fit Test, accessed 2026-10-19
  2. Gambling Control (Conduct of Gambling Operations) Regulations, 2026 (L.N. 112), regulation 45, accessed 2026-10-19
  3. Gambling Control (Licensing) Regulations, 2026 (L.N. 111), Form 11 (gambling equipment testing licence), accessed 2026-10-19