fanfeudThe mathematics of games of chance

Every edge figure on this desk is derived from the stated rules of the game, not from any operator.

Machines

Producing randomness, physically and otherwise

A game of chance is only as sound as its source of unpredictability, and there are exactly two ways to build one.

Every game discussed on this desk assumes a uniform sample space: thirty-six dice outcomes, thirty-seven pockets, fifty-two cards. That assumption has to be manufactured. Randomness is a physical or computational achievement, and the history of games of chance includes a long list of occasions when the achievement fell short.

Physical randomness

The traditional approach uses a device whose outcome is so sensitive to initial conditions that it cannot be controlled in practice. A die tumbling across a felt bed, a ball bouncing across pocket frets, a cage of numbered balls under air pressure: none of these is random in the sense of being uncaused. Each is deterministic and hopelessly unpredictable, because a difference in release far too small to reproduce produces a completely different outcome.

The weakness of physical randomness is that it depends on the object being uniform. A die with a defect favours a face. A wheel with a worn fret or a slight tilt favours a sector. The historical record contains real cases of biased wheels being identified by patient recording, which is the reason equipment tolerance, rotation and maintenance schedules became standard practice, and later regulatory requirements. Precision dice with sharp edges and flush-filled pips exist for exactly this reason: they are manufactured to remove the very asymmetries that would otherwise make the sample space non-uniform.

Algorithmic randomness

The alternative is to compute a sequence that behaves as if random. A pseudorandom generator takes a starting value, the seed, and applies a fixed transformation repeatedly to produce a stream of numbers. The stream is entirely determined by the seed: the same seed always produces the same sequence, which is why the technique is called pseudorandom rather than random.

Three properties decide whether such a generator is fit for a game. Its period, meaning how many values it produces before repeating, must vastly exceed any realistic amount of play. Its output must pass statistical tests for uniformity and independence. And, most importantly, its future output must not be inferable from its past output, which is a much stronger requirement than passing statistical tests and is the property that distinguishes a generator suitable for a game from one suitable only for a simulation.

Working, why the seed is the whole systema generator is a function: next = f(current)the entire sequence is fixed once the seed is chosenso the security of the game is the security of the seeda seed drawn from a small set can be searched exhaustively

That is why seeding is normally done from a physical entropy source rather than from anything predictable such as a clock reading. A generator with an enormous period seeded from a value an observer could guess offers no protection at all, because the observer can reproduce the whole stream.

Mapping a number onto a game

A raw generator output is a large integer, and the game needs a pocket, a card or a reel stop. The mapping step is where a subtle bias is easiest to introduce. If the generator produces values from zero to some maximum and the game needs thirty-seven outcomes, a naive remainder operation gives some outcomes marginally more values than others unless the range divides evenly. The correct treatment is to discard values in the leftover region and draw again, so that every outcome is backed by exactly the same number of underlying values.

Working, why a naive remainder biases the resultsuppose a generator yields 0 to 99 uniformly, and 37 outcomes100 = 2 x 37 + 26outcomes 0 to 25 each receive 3 source valuesoutcomes 26 to 36 each receive 2 source valuesdiscard 74 to 99 and redraw: every outcome then gets 2 values

Verifiable fairness

Because an algorithmic outcome leaves no physical trace, a further problem arises: a player cannot see that the number was generated before the wager rather than after it. The general solution is a commitment scheme. The operator of the game publishes a cryptographic hash of the seed in advance, accepts the wager, and afterwards reveals the seed. Anyone can then confirm that the revealed seed matches the published hash and produces the observed outcome. The commitment cannot be altered after the fact without breaking the hash.

This does not make a game fair in the sense of removing the edge, and it is worth being precise about that. The edge lives in the paytable and is untouched. What a commitment scheme establishes is that the outcome was not chosen after the stake was known, which is a different and narrower guarantee.

The equivalent guarantee for physical equipment is procedural rather than cryptographic: sealed and inspected devices, recorded draws, and independent observation. Both approaches answer the same question, which is whether the sample space that the mathematics assumes is the sample space the game actually uses.