The story behind random numbers, dice, cards, coins and lots
Long before computers, people used bones, dice, cards, coins and lots to let chance decide. The random generator puts five of those tools in your browser. This page explains where they come from and what makes a result fair.
From knucklebones to dice
The first dice were the ankle bones of sheep and goats, thrown in games across the ancient world. Cubic dice with pips have been found at Shahr-e Sukhteh in Iran, from about 2500 BC, and in the cities of the Indus Valley. On a modern die the opposite faces add up to 7, a rule that already held for most Roman dice. Role-playing games made other shapes popular, such as the twenty-sided d20, but each is fair only when every face is equally likely.
A deck of 52
Playing cards reached Europe from the Islamic world in the late fourteenth century, and the French suits of spades, hearts, diamonds and clubs date from about 1480. A deck of 52 cards can be ordered in 52! ways, a number with 68 digits. That is so many that a well shuffled deck is almost certainly in an order no deck has ever had before. The mathematicians Dave Bayer and Persi Diaconis showed in 1992 that about seven riffle shuffles are needed to mix a deck properly.
Is a coin toss really 50/50?
Almost. In a 2023 experiment, 48 people tossed coins 350,757 times, and the coin landed on the side it started on in about 50.8% of the tosses, as Persi Diaconis had predicted from the physics of a spinning coin. A virtual coin has no starting side and no wobble: heads and tails each have a chance of exactly one half.
Drawing lots
Drawing lots is one of the oldest ways to decide fairly: the Bible tells of lots cast to share out land, and ancient Athens chose many of its officials by lot. In the Netherlands and Flanders, families and colleagues draw names for Sinterklaas on 5 December, and in many other countries the same game is called Secret Santa. A draw in which nobody gets their own name is what mathematicians call a derangement. With more than a few people, about 37% of all ways to share out the names, 1 in e, leave nobody with their own, so a fair shuffle that starts again whenever someone draws themselves needs only about three tries.
A fair random number in the browser
The random generator asks crypto.getRandomValues for a whole number between 0 and 4,294,967,295. Taking the remainder after dividing by 100 would make the lowest numbers a tiny bit more likely, because 4,294,967,296 is not a multiple of 100. So the app throws away the few values in the last incomplete block and draws again. Every number from 1 to 100, every face of a die and every card in the deck then has exactly the same chance.
Frequently asked questions
Can I use it for a raffle or a lottery pick?
Yes. Choose Number, set the range of the ticket numbers, the number of winners and turn on No repeats, so no ticket can win twice. Copy the history as proof of the draw.
Why did I roll the same number three times in a row?
Because each roll is independent. With one die, the chance of the same number three times in a row is 1 in 36, so it happens often. Dice have no memory; believing that another number is now due is the gambler's fallacy.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Open the random generator