One order out of 52 factorial
A perfectly shuffled deck is one where every possible order is equally likely. There are 52 × 51 × 50 × … × 1 of them:
No real shuffle hits each order with probability exactly 1/52!. Mathematicians measure how far off it is with the total variation distance:
It has a practical reading. d is the largest edge a gambler could gain on any bet about the deck's order, such as "the ace of spades is in the top half" or "two kings sit next to each other". A distance near 1 means some bet is almost a sure thing.
Six ways to shuffle, run side by side
Each technique below runs on its own 52-card deck. The coloured strip is the deck, from top card to bottom card, coloured by where each card started. A random deck looks like confetti. The heatmap is exact: it shows where every card can end up after this many shuffles.
Rows are where a card started, top to bottom. Columns are where it can be now. A dark diagonal means cards haven't moved. An even tone means every card is equally likely to be anywhere.
Position bias is the average distance of each row from uniform. It is a necessary check, not a sufficient one: a deck can pass it while pairs of cards still stick together.
Rising sequences and the cutoff
Cut a sorted deck and riffle it once. Read through the result for card 1, then 2, then 3, and so on, and you will find the deck is two increasing runs woven together. These are rising sequences. A second riffle can at most double their number, so after k riffles there are at most 2k.
In 1992 Dave Bayer and Persi Diaconis showed that under the Gilbert–Shannon–Reeds model, the chance of any particular order depends only on how many rising sequences r it has:
Group the 52! orders by r (the counts are Eulerian numbers) and the distance from random becomes a sum of 52 terms. Every number on this page labelled "exact" comes from that sum, computed live in your browser.
The result is a cutoff: nothing much happens, then the distance collapses within two or three riffles. The cliff sits at roughly ³⁄₂ log₂ n riffles, so doubling the deck costs only about one and a half more.
A trick that runs on this. Charles Jordan sold it in the 1920s. Hand a spectator a sorted deck, have them riffle it three times, move one card, and riffle once more. With at most 16 rising sequences, the moved card is the one that doesn't fit any of them.
Exact distance from random under the GSR model. 312 cards is a six-deck blackjack shoe. Hover or tap the chart to read values.
Time at the table to reach a random deck
Shuffle counts for 52 cards come from the research. Seconds per shuffle are rough hand speeds we assumed, so read the bars as orders of magnitude.
| Technique | Needed for 52 cards | Grows like | Source | Verdict |
|---|---|---|---|---|
| Riffle | 7 riffles | ³⁄₂ log₂ n | Bayer & Diaconis, 1992 | Use this |
| Smoosh / wash | 30–60 seconds | ½ n ln n swaps (model) | Diaconis & Shahshahani, 1981; Diaconis lab tests | Good |
| Top-to-random | ≈ 236 moves | n ln n | Aldous & Diaconis, 1986 | Slow |
| Overhand | ≈ 10,000 shuffles | n² log n | Pemantle, 1989; Jonasson, 2006 | Hopeless alone |
| Pile | Never | Fixed permutation | Arithmetic | No randomness |
| Perfect faro | Never | Fixed permutation | Arithmetic | Magicians only |
Machines aren't automatically better. In 2013 Diaconis, Jason Fulman and Susan Holmes analysed a shelf-shuffling machine used in casinos. One pass left so much order behind that a player could guess about 9.5 cards of a 52-card deck correctly, against 4.5 for a truly random deck. The manufacturer changed the design.
Practical rule: for home games, riffle seven times. Add a cut if you like. Cuts don't add randomness, but they don't hurt. If you can't riffle, spread the cards face down and smoosh them around for a full minute.