inicasino.netContents

Laboratories and certificates · 10 / 23

How online RNGs are tested

A random number generator in a regulated game is tested in two ways. People read its code, and programs measure its output. Each catches faults the other would miss.

Short answer

Before an online game is released in a regulated market, a test laboratory that is separate from the supplier examines its random number generator: the source code, the way it is seeded, the way raw numbers are scaled to game outcomes, and long runs of output with statistical tests. Passing shows that the software met a standard at that time. It is not a check of each later result, and statistics alone cannot show that a generator is unpredictable.

Flow diagram with 8 steps: Source code; Statistical output; Distribution; Independence; Unpredictability; Seeding; Scaling; No adaptive behaviour.
Source review, statistical tests, seeding and scaling, quoted from the standards.

Key facts

  • In Great Britain the testing is done by an approved third-party test house before release (testing strategy).
  • GLI-19 requires the RNG that determines game outcomes to be “cryptographically strong” (section 3.3.1).
  • RTS 7 requires results to be “acceptably random” and forbids adaptive behaviour.
  • At a 99 % confidence level a sound generator fails about one test run in a hundred.
  • In 2022 NIST decided to revise its statistical test suite and said the revision would clarify its purpose, “rejecting its use for assessing cryptographic random number generators” (NIST).

Two kinds of generator

A pseudorandom generator is an algorithm with an internal state. Given the same starting state, called the seed, it produces the same sequence every time. Its quality rests on the algorithm and on the secrecy and randomness of the seed. A hardware generator measures a physical process such as electronic noise. Its output is not reproducible, and it can drift or fail as a device ages.

GLI-19 version 3.0 treats both. Section 3.3.1 requires that the RNG that determines game outcomes “shall be cryptographically strong”, and section 3.3.3 requires that where a hardware-based RNG is used “there shall be dynamic monitoring of the output by statistical testing”.

What is examined

Diagram that pairs each item with its counterpart. Requirements placed on an RNG, with their source: Source code; Statistical output; Distribution; Independence; Unpredictability; Seeding; Scaling; No adaptive behaviour.
Requirements placed on an RNG, with their source
Requirements placed on an RNG, with their source
AreaWhat the text asksSource
Source codeReview of the code of the core randomness, scaling and shuffling algorithmsGLI-19 v3.0, 3.2.1
Statistical outputTests evaluated collectively at a 99 % confidence level. Named tests: Total Distribution or Chi-square, Overlaps, Coupon Collector's, Runs, Interplay Correlation, Serial Correlation, DuplicatesGLI-19 v3.0, 3.2.2
Distribution“Each possible RNG selection shall be equally likely to be chosen.”GLI-19 v3.0, 3.2.3
IndependenceKnowing the numbers of one draw gives no information about the numbers of anotherGLI-19 v3.0, 3.2.4
Unpredictability“it shall be computationally infeasible to predict or estimate future RNG values”GLI-19 v3.0, 3.3.2
Seeding“the RNG shall not be seeded from a time value alone”GLI-19 v3.0, 3.3.2
ScalingUniform distribution and unpredictability have to survive any scaling of the raw outputGambling Commission, RTS 7 guidance
No adaptive behaviourInterventions that change the probabilities of outcomes during play are prohibited. The text calls the result a compensated game.Gambling Commission, RTS 7A

The last two rows are from the Gambling Commission's RTS 7, whose requirement is that random number generation and game results be “acceptably random”. Its testing strategy places the statistical analysis with an approved third-party test house before release.

What statistical tests can show

A statistical test takes a long run of output and asks whether some measurable property, such as the frequency of each value or the length of runs, is within the range expected of a random source. A generator that fails repeatedly is defective. A single failure proves little: at a 99 % confidence level a sound generator fails about one run in a hundred. A generator that passes has shown only that this run did not look unusual in the ways that were measured.

Passing is therefore necessary and not sufficient. A counter fed through a hash function with a key produces output that passes such tests, and anyone holding the key can predict every value. NIST made the same point about its own test suite: in announcing a revision of SP 800-22 in 2022 it said the revision would clarify the purpose and use of the suite, “in particular rejecting its use for assessing cryptographic random number generators”. Unpredictability is established by reviewing the design, the code and the seeding, which is why the standards require those reviews alongside the statistics.

Scaling and mapping

Raw output is a large integer. A game needs a card, a reel stop or a die face. The step between them is where avoidable unevenness enters, as the page on turning a hash into a number shows with exact counts. Standards put this step inside the scope of the review.

Are online slots really random?

Where a regulator applies rules like those above, the draw has to be random in the tested sense. Random does not mean even. Each draw is mapped to outcomes through a pay table designed so that the game returns less than it takes in over time. A tested RNG is evidence that draws are not being steered. It leaves the house edge exactly as designed.

Can an RNG be manipulated after testing?

A test covers the version that was submitted. Whether the software in service is that version is a matter of change control by the operator and supervision by the regulator. A player has no means of inspecting either. This is the gap a per-round check addresses for a single result, as set out on the page comparing provably fair and certified RNGs. What the resulting document says is covered on the page about RNG certificates.

How this differs on a blockchain

A program on a public blockchain cannot keep a secret seed, since every node runs the same code on the same data. It has to take randomness from outside its own state, and each outside source brings a party that can influence it. That subject has its own page, on on-chain randomness.

What happens in a test, step by step?

  1. The supplier gives the laboratory the software, its source code and its documentation.
  2. The laboratory reviews the algorithm of the generator and how it is seeded and reseeded.
  3. It reviews how raw output is scaled to the range a game needs and how items such as cards are shuffled.
  4. It collects long runs of output and applies statistical tests.
  5. It reports what was examined, in which version, against which standard.
  6. After release, changes to the software fall under the regulator's rules on changes.

This outline follows the areas named in GLI-19, chapter 3, and in the Commission's testing strategy. Each laboratory's own procedure is more detailed and is not public in full.

How should a statistical result be read?

Bar chart. Chance that a sound generator passes every one of a number of independent tests at a 1 % threshold: 1 = 99.0 %; 5 = 95.1 %; 10 = 90.4 %; 20 = 81.8 %; 50 = 60.5 %.
Chance that a sound generator passes every one of a number of independent tests at a 1 % threshold.

A test turns a run of output into a number, the p-value: the chance that a truly random source would look at least this unusual. A laboratory sets a threshold, for instance 1 %. With that threshold a sound generator fails one run in a hundred by chance alone.

If 20 independent tests are applied to one run, the chance that a sound generator passes all of them is 81.8 %. So, if the tests were independent of one another, nearly one sound generator in five would show a failure somewhere, and a single failure among twenty proves nothing. Laboratories therefore repeat tests on fresh output and look for failures that persist.

What can testing not show?

  • That the next result is unpredictable to someone who knows the internal state. That is a property of the design and of the secrecy of the seed.
  • That the tested version is the one running today.
  • That the pay table of a game yields its stated return, unless the game itself was tested.
  • That a particular round you played was drawn correctly. For that question the only tool is a scheme you can recompute, compared on the page provably fair vs certified RNG.

Which beliefs about RNGs are mistaken?

  • That a tested RNG evens out results over a session. Independence means no memory of past results.
  • That a pseudorandom generator is a weaker kind by nature. GLI-19 treats both kinds and asks for cryptographic strength.
  • That passing statistical tests proves randomness.
  • That a certificate covers every game on a site. It covers the named product and version, as the page about RNG certificates shows.

Which terms does this page use?

PRNG
Pseudorandom number generator: an algorithm that produces a sequence from a starting state.
Hardware RNG
A device that measures a physical process. Also called a true RNG or TRNG.
Seed
The starting state of a pseudorandom generator. Not the same thing as the seeds of a provably fair game, described on the page about the server seed, client seed and nonce.
Scaling
Turning raw output into the range a game needs. The page from hash to number shows how a careless method favours some results.
p-value
The chance that a random source would produce a test statistic at least as extreme as the one observed.
Test house
A laboratory, separate from the supplier, that examines gambling software.

Questions people ask

What is the difference between a PRNG and a TRNG?

A pseudorandom generator computes its output from a seed and is reproducible if the seed is known. A true or hardware generator measures a physical process and is not reproducible. Many systems use hardware output to seed and reseed a pseudorandom generator.

Does a passed test mean the next result cannot be predicted?

No. Statistical tests measure patterns in output. Unpredictability depends on the algorithm and on how it is seeded, which is examined by reading the code.

Who tests the RNG of a game offered in Great Britain?

A test house approved by the Gambling Commission, before release, according to the Commission's testing strategy.

How are online casino RNGs tested?

A laboratory reviews the source code, the seeding and the scaling, and applies statistical tests to long runs of output, before the game is released. The steps are listed on this page.

Can an online casino RNG be manipulated?

Software can be changed by whoever controls it. Regulated markets answer this with rules on changes and with supervision, and a player can inspect neither. A recomputable scheme answers it for single rounds.

What is GLI-19?

A technical standard for interactive gaming systems published by Gaming Laboratories International. Chapter 3 of version 3.0 holds its requirements for random number generators.

How often is an RNG tested?

Before release, and again when the regulator's rules on changes require it. The schedule is set by each regulator, so the answer for a given game is in that regulator's rules.

Which statistical tests are used?

Tests of the frequency of values, of runs and of other measurable patterns in long output. RTS 7 asks for randomness to be shown with high confidence and names statistical analysis as an example of how.

Does a tested RNG let me check my own result?

No. Testing happens before release and concerns the software. Only a game that publishes the inputs of each round lets you check one.

What is a casino RNG?

The software, or less often a device, that produces the random numbers a game turns into cards, reel stops or dice. In an online game it runs on a server, and the player sees only the outcome.

Sources

How we checked: statements about a named body link to that body's own page and carry the date we read it. Numbers in worked examples are computed by the site's build from the formulas shown, with routines covered by its test suite.