A standard deck of 52 cards can be arranged in 52! ways — that's 52 × 51 × 50 × … × 1, roughly 8 × 1067. Written out, it's a 68-digit number. Shuffle properly and the order in your hands has almost certainly never existed before in the history of card games.
But "shuffle properly" is doing a lot of work in that sentence. A shuffle isn't magic; it's a mechanical rearrangement, and a few of them can leave a surprising amount of the old order intact. So how many is enough?
Below is a fresh deck seen edge-on. Each card is coloured by where it started, so a new deck is a smooth rainbow. Press Riffle to do one realistic riffle shuffle: the deck is cut roughly in half, and cards drop from the two halves one at a time, with the bigger pile more likely to drop next.
A brand-new deck: one long run in perfect order.
After one riffle the rainbow is still obviously there: you've just zipped two smooth bands together. The deck now consists of exactly two rising runs — start at card 1, find card 2, card 3, and so on, and you only have to go back to the beginning once. Each riffle can at most double the number of runs: 2, 4, 8, 16… A fully random deck typically has around 26 of them, so after three or four shuffles the deck is still carrying a fingerprint of where it came from.
In 1992, mathematicians Dave Bayer and Persi Diaconis (a former professional magician) worked out exactly how random a deck is after any number of riffles, in a paper with the wonderful title "Trailing the dovetail shuffle to its lair". They used a model of the riffle first described by Edgar Gilbert and Claude Shannon at Bell Labs in 1955 and independently by Jim Reeds in 1981 — the same model the demo above uses.
Their key discovery was that the chance of ending up with any particular order depends only on how many rising runs it has. That turns an impossible 68-digit calculation into a short one. Here is their table for 52 cards:
| riffles | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| distance | 1.000 | 1.000 | 1.000 | 1.000 | 0.924 | 0.614 | 0.334 | 0.167 | 0.085 | 0.043 |
Look at the shape. For four shuffles nothing seems to happen: the distance sits at 1, meaning a clever observer could almost always tell your deck apart from a truly random one. Then it falls off a cliff. Seven riffles is the first time the distance drops below one half, and after that every extra shuffle roughly halves what's left. This sudden drop is now called the cutoff phenomenon, and it shows up in many other mixing processes.
Drag the slider to change the deck size. The curve is computed live from the Bayer–Diaconis formula. Doubling the deck doesn't double the work — it adds roughly one or two shuffles, because the number needed grows with the logarithm of the deck size.
The riffle is powerful because it moves every card at once. The overhand shuffle — sliding small clumps from one hand to the other — only moves chunks around, and it takes about 2,500 of them to mix 52 cards to the same standard.
And a riffle that is too good is useless. Press Perfect shuffle above: it cuts the deck exactly in half and interleaves the cards one-for-one, the move magicians call a faro. It looks thoroughly mixed after a couple of goes — then, after eight perfect shuffles, the deck is back in its original order. Real randomness needs the sloppiness of human hands: uneven cuts and clumps of cards falling together.
If it matters — a poker night, a board game where the draw decides everything — give the deck seven good riffles. Fewer, and some of the previous hand's order is statistically still there. More than about ten adds very little. And if you're only doing an overhand shuffle, you can relax: nobody is doing 2,500 of those.