the ground / stratum · Pattern
Take a brand-new deck, in perfect factory order, and riffle it the way everyone does — split, bridge, repeat. After one shuffle it is obviously still ordered. After two, still. The surprise is what the mathematics says about the moment it stops: not a slow fade, but a cliff. Almost nothing, for several shuffles — and then, all at once, random. The edge of that cliff is at seven.
It sounds like the kind of question with no clean answer — random is a slippery word, a deck is a deck, surely it just gets gradually more jumbled. But the question has a precise answer, it is one of the prettiest results in modern probability, and it is not what intuition guesses. The randomization does not creep in. It arrives suddenly.
To ask it properly we need to pin down two things: what a shuffle is, and what random means.
The shuffle first. When you riffle a deck — the casino calls it a dovetail — you cut it roughly in half and let the two halves fall back together in a rough interleave. In the early 1950s Gilbert and Shannon, and independently Reeds, wrote down the natural mathematical idealization, now called the GSR model: cut the deck into a top packet and a bottom packet, where the size of the cut is as random as flipping a coin for each card; then drop cards one at a time from the bottoms of the two packets, each drop favouring the larger packet in exact proportion to its size. That single rule reproduces the statistics of real human riffles remarkably well — Diaconis has the video and the data — and it has a magical property we will lean on hard: shuffles multiply. A GSR riffle is what's called a 2-shuffle (the deck is cut into 2 packets); do it again and the composition is exactly a 4-shuffle; k riffles in a row is precisely one 2k-shuffle. We will get the whole answer out of that.
Now random. There are 52! possible orderings — a number near 8×1067, more than the estimated atoms in our galaxy. A perfectly shuffled deck is one where all 52! orders are equally likely. After a finite number of riffles they are not equally likely: some orders are far more probable than others, because the shuffle can't undo every pattern at once. So we measure how far the real distribution is from the perfect one. The standard yardstick is total-variation distance: across all possible orders, the largest gap in probability between "the deck as it actually is" and "a perfectly random deck." It runs from 1 (a dead giveaway — you could win a bet about the order) down to 0 (truly indistinguishable from random). The question "how many shuffles?" becomes: how many riffles drive that distance down to near zero?
Watch a deck shuffle. Below, the 52 cards are drawn as a strip coloured by their starting position — a smooth gradient from one end to the other, so order is something you can see. Riffle it and the gradient breaks into two interleaved combs; riffle again and the combs break into finer ones. The eye loses the pattern fast — but the deck does not. It carries a hidden fingerprint.
The fingerprint is the number of rising sequences. Pick up the shuffled deck and find where card 1 sits, then card 2, then 3 — every time the next card is somewhere after the last, you're still in the same rising run; when it jumps backward, a new run begins. A fresh deck is a single rising sequence. Here is the key fact, and the whole reason this problem is solvable: one riffle can at most double the number of rising sequences. So after k shuffles there are at most 2k of them — one shuffle, at most 2; seven shuffles, at most 128. The fingerprint counts your shuffles. Bayer and Diaconis titled their paper, perfectly, "Trailing the dovetail shuffle to its lair."
Colour is each card's starting position, so the opening gradient is the deck in order. Each riffle splits it (GSR) and interleaves; the rising sequences are the maximal runs in which the cards still climb in their original order — drawn as the bracketed segments. Watch the count: it can at most double per shuffle, and it heads for about half the deck (~26) once the deck is mixed, at which point the fingerprint can no longer tell you much. The shuffle and the rising-sequence counter here are the exact routines certified offline in /research/seven-shuffles/ (checks 7–9).
That last clause is the hinge of everything. While the deck is under-shuffled, the rising-sequence count is small and revealing; once it climbs toward its random value, the fingerprint saturates and the order is genuinely lost. The distance-to-random is just this story, made exact.
Here is the theorem that closes the problem. Bayer and Diaconis (1992) proved that after a 2k-shuffle, the probability of ending in a particular order depends on nothing about that order except its number of rising sequences r:
P(order) = C(2k + 52 − r, 52) / 252k
Every order with the same number of rising sequences is exactly equally likely; orders with more rising sequences are rarer. Count how many orders have each value of r — those counts are the famous Eulerian numbers — and you can sum up the total-variation distance to the perfect deck exactly. No simulation, no approximation: a finite sum of whole-number ratios. The integers involved are enormous (52! has 68 digits; 252·10 has 157), so the instrument below carries them in exact BigInt arithmetic and only rounds at the very last step — the same computation as the offline proof, reproducing the canonical table digit for digit.
Press a shuffle count and read the distance. Then read the column of them together, and the shape of the answer jumps out.
Each bar is the exact total-variation distance to a perfectly shuffled deck after that many riffles, computed live from the Bayer–Diaconis formula with BigInt arithmetic. For 52 cards the curve is the signature of a cutoff: it clings to 1 — totally unshuffled, in effect — through four riffles, then falls off a cliff, crossing the half-way line at the seventh. Slide the deck size and watch the cliff move: a bigger deck needs more shuffles, but always with the same abrupt drop. The center of the cliff sits near (3/2)·log₂n ≈ 8.5 for 52 cards; the deck is already half-mixed a little before that, at seven.
This shape has a name: the cutoff phenomenon. The distance does not decay smoothly; it stays near its maximum, then collapses through a narrow window. For most of the shuffles you do, you are accomplishing almost nothing measurable — and then, within a shuffle or two, the deck goes from "you could bet on it" to "indistinguishable from random." Aldous and Diaconis found this same abrupt-transition behaviour across a whole family of shuffles and walks in the 1980s; the riffle is its most famous instance. It is the reason there is a number at all. If randomization crept in gradually, "how many shuffles?" would have no clean answer. It crept in like a cliff, so it does.
Why seven, specifically? Read it off the curve. The standard convention is that a deck is "well shuffled enough" once the distance has dropped below one-half — close enough that no betting strategy has a meaningful edge. The distance is still essentially 1 through four shuffles; it is 0.924 at five, 0.614 at six, and at seven it finally falls under a half, to 0.334. Each further shuffle then roughly halves it — 0.167, 0.085, 0.043 — but the qualitative job is done at seven. That is the number Diaconis gave, and it is why a 1990 New York Times story ran under the headline that seven is the magic number for a deck of cards.
If a shuffled deck still carries the mark of how many times it was riffled, then in principle you can read that mark — guess the number of shuffles from the order alone. That is exactly the "lair" in Bayer and Diaconis's title, and it is the same fact as the mixing time, seen from the other side. The instrument below hands you a deck riffled a hidden number of times; it counts the rising sequences and asks the maximum-likelihood question — for which shuffle-count is this many rising sequences most probable? Early on, the guess is sharp. Once you pass the cutoff, the fingerprint saturates near its random value and the estimate goes blind. Detection fails at precisely the point the deck is mixed — because those are the same statement.
A fresh deck is riffled a hidden number of times (1–11) and handed to you face-up. The detector counts its rising sequences and finds the shuffle-count under which that order is most likely (maximum likelihood over the Bayer–Diaconis law, computed in BigInt). Deal a few. While the deck is under-shuffled the guess lands on the nose; past the cutoff — seven and up — the rising-sequence count has saturated near its random value (~26) and the detector can no longer separate "seven shuffles" from "a thousand." That blindness is not a flaw in the detector; it is mixing. A deck the best detector can't read is, by definition, random.
It is worth saying what this does and does not claim. It is about the riffle, idealized as GSR. Other shuffles are not so kind: the overhand shuffle — sliding small packets off the top — is dramatically worse, needing thousands of repetitions to mix a deck, because each pass moves so little. And "well-mixed below one-half" is a convention; a casino guarding against a card counter, or a cryptographer, might want the distance far smaller, which is why dealers' shoes and shuffling machines do considerably more than seven. The clean, citable, beautiful fact is the one drawn above: for the riffle, the order of a 52-card deck survives almost intact for four shuffles, and is gone by seven — and the going is a cliff, not a slope.
The two edges that bind this place: every factual claim is checked, and every model is named a model. The shuffle here is the Gilbert–Shannon–Reeds idealization of a riffle — a model, chosen because it matches measured human shuffles well (Bayer–Diaconis 1992) and because it makes the problem exactly solvable; it is not a claim that every hand riffles identically. The distance values (1.000, 1.000, 1.000, 1.000, 0.924, 0.614, 0.334, 0.167, 0.085, 0.043) are the exact total-variation distances, recomputed in front of you with BigInt arithmetic and re-derived offline to the last digit in /research/seven-shuffles/verify.mjs (24/24 checks, including the published Aldous–Diaconis table, the GSR shuffle against its exact law, and the rising-sequence counter against the Eulerian numbers). "Seven" is the first shuffle whose distance falls below one-half; the asymptotic cutoff center is (3/2)·log₂52 ≈ 8.55.