A Brief History of Randomness: From Dice to Cryptography

Published by TheRandomNumber.com

The desire to generate random outcomes is ancient. Long before probability theory existed, humans were rolling dice, drawing lots and consulting oracles — all in the service of producing a result that no one could predict or manipulate. The tools have changed enormously over the millennia, but the underlying need is the same: a way to make decisions, allocate resources or generate numbers with no predictable pattern.

Ancient dice: the oldest random number generators

The oldest known dice were found in a backgammon-like game unearthed in south-east Iran, dating to around 3000 BCE. Similar objects — knucklebones, or astragali, the ankle bones of sheep and goats — were in use even earlier, serving as crude dice with four distinct sides. Ancient Egyptians, Greeks, Romans and Indians all had dice games, and the basic mechanism — a physical object with equal probabilities on each face — is the same one that appears in every tabletop RPG played today.

Dice served not only for games and gambling but for divination and decision-making. Casting lots — essentially drawing random items from a container — was used in ancient Israel to divide land, select officials and make legal decisions. The Roman army used lots to select soldiers for punishments. Many ancient cultures believed that genuinely random outcomes revealed divine will, giving randomness a spiritual dimension alongside its practical one.

The coin flip through history

Coin flipping has a documented history in ancient Rome, where it was called "navia aut caput" — ship or head, after the images on coins of the era. Julius Caesar was said to resolve disputes by coin flip, and the practice of calling "heads or tails" before a toss has persisted ever since. In medieval England, the practice was called "cross or pile", referring to the cross on one face and the pile (or cross-hatch) on the reverse.

The coin flip endures because it is simple, requires no equipment beyond a coin and is inherently fair — or at least, it was assumed to be until researchers like Persi Diaconis demonstrated the small same-side bias that physical flipping introduces. That bias was only measurable in the 21st century, which explains why the coin flip remained the world's most trusted tiebreaker for several thousand years without anyone noticing the problem.

The first random number tables

The modern scientific need for large quantities of random numbers emerged in the early 20th century. Statisticians designing experiments, actuaries computing probabilities and physicists running simulations all needed more random numbers than dice could practically generate at scale.

In 1927, statistician Leonard Tippett published a table of 41,600 random numbers drawn from census data. This was followed by other published tables, and in 1955, the RAND Corporation published "A Million Random Digits with 100,000 Normal Deviates" — exactly what it sounds like, a book containing a million random numbers generated by an electronic roulette wheel. Researchers would look up numbers in the table rather than generate them themselves. The book was reprinted in 2001 and remains useful in specific contexts today.

Early computing and the problem of software randomness

When computers arrived, the need for random numbers scaled dramatically. Simulations, cryptography, games, statistical software — all required a steady supply of random values. But computers, by their nature, are deterministic machines. Given the same input, they produce the same output every time. True randomness was not something they could generate natively.

The solution was the pseudo-random number generator (PRNG): an algorithm that produces sequences of numbers that pass statistical tests for randomness without actually being random. John von Neumann's middle-square method (1946) was an early attempt — notoriously flawed, but the first systematic approach. Linear congruential generators followed, and became the workhorses of computing randomness for decades.

The mathematician Donald Knuth wrote extensively about the theory and implementation of PRNGs in "The Art of Computer Programming" (1969), formalising what "random enough" meant for different applications. His work established the field of computational randomness as a serious discipline rather than an afterthought.

The Mersenne Twister and modern PRNGs

In 1998, Japanese mathematicians Makoto Matsumoto and Takuji Nishimura published the Mersenne Twister algorithm, which rapidly became the default PRNG in most programming languages and statistical software. It has an astronomically long period before its sequence repeats (2¹⁹⁹³⁷ − 1), passes essentially all standard statistical tests for randomness and is fast enough for practical use. Python's built-in random module uses it. R uses it. It appears in countless games and simulations.

The Mersenne Twister is, however, not cryptographically secure. Given 624 consecutive outputs, it is possible to reconstruct the internal state and predict all future outputs. For most applications this does not matter, but for anything security-sensitive it is completely inadequate.

Cryptographic randomness and the modern web

The development of internet cryptography in the 1990s created a pressing need for unpredictable random numbers. Encrypting communications, generating session keys, creating authentication tokens — all require randomness that an adversary cannot predict. This drove the development of cryptographically secure pseudo-random number generators (CSPRNGs), which draw from genuine hardware entropy to seed algorithms designed to be computationally infeasible to reverse or predict.

Modern operating systems expose this capability to applications: /dev/random and /dev/urandom on Linux and macOS, CryptGenRandom on Windows and, in the browser, window.crypto.getRandomValues() — the Web Cryptography API standardised by the W3C. This API draws from the operating system's entropy pool and is available in every modern browser, making cryptographic randomness accessible to any web application without requiring server-side components.

This is what TheRandomNumber.com uses for every result. The journey from knucklebones in 3000 BCE to browser-based cryptographic entropy in 2026 covers quite a lot of ground — but the fundamental purpose has not changed at all.

Every result from the tools on this site — random numbers, dice rolls, coin flips, lottery picks — uses window.crypto.getRandomValues(), the same cryptographic randomness API used in browser security software. It runs entirely in your browser with no server involved.

What comes next

Quantum random number generators (QRNGs) represent the current frontier. These devices exploit quantum mechanical processes — such as photon polarisation or radioactive decay — that are genuinely non-deterministic at a fundamental physical level, not merely computationally unpredictable. Commercial QRNGs are already available and are gradually being integrated into hardware and cloud platforms. For practical purposes, a well-seeded CSPRNG is already indistinguishable from a QRNG, but the philosophical difference — between "computationally unpredictable" and "fundamentally non-deterministic" — continues to matter to physicists, philosophers and those with very specific security requirements.

This article provides a general historical overview of random number generation. Technical descriptions are simplified for general audiences.