Skip to main content
TirageAuSort.io
Chance and randomness

Pseudo-random number generator

Also called : RNG, PRNG, random number generator

An algorithm that produces sequences of numbers that appear random but are entirely determined by a starting value called the seed.

A pseudo-random number generator is an algorithm that produces sequences of numbers that appear random but are in fact entirely determined by a starting value called the seed. The prefix "pseudo" matters: these numbers imitate chance without being it, because they result from an exact and reproducible computation.

An image illuminates the principle: a very long cooking recipe that, starting from a single initial ingredient, chains together thousands of mechanical steps. The final dish seems unpredictable as long as the detail of the operations is unknown, but the recipe always gives the same result from the same starting ingredient.

Concretely, the generator starts from the seed, applies a mathematical transformation to it to produce a first number, then reuses that number to compute the next, and so on. Each value flows from the previous one. The sequence is therefore perfectly determined: with a given seed, the generator reproduces exactly the same sequence, identically, as many times as it is rerun.

This is where the main misconception lies: thinking that a computer manufactures true chance. It does not. A machine only executes instructions, and a computation remains a computation. To obtain real unpredictability, the seed is most often fed from a variable external source, for example the precise instant of launch, so that the sequence changes every time.

Despite this deterministic nature, the quality of these generators is more than sufficient for playful and decision-making uses. This is the mechanism that runs the site's coin flip, dice, wheel, and prize draw, guaranteeing results that are unpredictable in practice and fair across all possible outcomes.

Example

The site's prize draw calls a pseudo-random number generator to pick a winner from among the participants.

Related terms