the ground / stratum · Pattern

How Many Shuffles Until It's Random?

deck 52 cards shuffle ordinary riffle (GSR) answer seven checks 24/24

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 distance to a uniform deck: not a slow fade, but a cliff. Almost nothing changes in that distance for several shuffles; then it drops sharply, crossing this page's one-half threshold at seven. About 0.334 remains.

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. Gilbert and Shannon's work, reported by Gilbert in 1955, and Reeds's independent work in 1981 gave 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 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 sets of 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?

I · The shuffle, and the mark it leaves

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 helps estimate your shuffles. Bayer and Diaconis titled their paper, perfectly, "Trailing the dovetail shuffle to its lair."

Instrument 1 · the riffle and its fingerprintGSR shuffle · live

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 maximal sequences of consecutive card values appearing in their original relative order. The brackets mark contiguous fragments of those sequences. 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; as shuffling continues, its distribution approaches that of a uniform deck. A single near-average count does not certify randomness. The distance-to-random measures the gap between the whole distributions.

II · The exact distance, and the cliff

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.

Read the distances across the shuffle counts, then move the deck-size slider to recompute the curve. The shape of the answer jumps out.

Instrument 2 · distance to a perfect deckexact · recomputed in-browser (BigInt)

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. From five to seven riffles, the distance drops from about 0.924 to 0.334, crossing this page's chosen one-half threshold while leaving detectable bias. 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. The threshold gives us a stopping point, and the cliff makes the approach to it striking.

For the first four riffles you are, to a very good approximation, not shuffling at all. The work happens in a window two shuffles wide.

Why seven, specifically? Read it off the curve. This page chooses total-variation distance below one-half as its stopping point. 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. Seven crosses our threshold, but some bets still have a substantial advantage: Levin, Peres and Wilmer describe a solitaire game with win probability about 0.801 after seven GSR riffles, versus 0.5 for a uniform deck. Their textbook uses one-quarter as its default mixing-time tolerance, which this deck reaches at eight. Seven 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.

III · Reading the fingerprint back

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 the "lair" in Bayer and Diaconis's title. 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 fingerprint is informative, but the guess can still miss. As the distributions approach uniform, the counts become harder to separate. Estimating a shuffle count is a different task from testing uniformity. An incorrect guess does not establish that the deck is mixed.

Instrument 3 · trailing it to its lairmax-likelihood detector · live

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, using BigInt combinatorial terms and floating-point logarithms). Deal a few. The guess can miss even before seven. Past the cutoff, seven and up, the rising-sequence count has saturated near its random value (~26); that does not make seven shuffles indistinguishable from a thousand. The candidates here run only from 1 to 11. A count estimate does not certify uniformity, and seven riffles still leave a total-variation distance of about 0.334.

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. Our one-half threshold is a choice; a casino or a cryptographer might want the distance far smaller. Practice depends on the method: Kolata's 1990 report described four to seven shuffles in Las Vegas, while Diaconis's 2003 survey describes a shelf-shuffler operation that is not repeated. Those are dated descriptions of different methods; a machine pass need not be a GSR riffle. The clean, citable, beautiful fact is the one drawn above: for the riffle, the distance from uniform stays near one through four shuffles and drops below one-half at seven, with bias still remaining. 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 rounded total-variation distances, recomputed in front of you with BigInt arithmetic and re-derived offline to the last displayed digit in /research/seven-shuffles/verify.mjs (24/24 checks, including the published Bayer–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.

Corrections

Corrected 2026-10-14: The page placed Gilbert, Shannon and Reeds together in the early 1950s. Gilbert reported the Gilbert–Shannon work in 1955; Reeds independently developed the model in 1981 (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The page said seven riffles made the deck indistinguishable from random and that its detector could not distinguish seven from a thousand. Seven first crosses this page's one-half total-variation threshold, with distance about 0.334 remaining; the rising-sequence statistic retains information, and this detector only compares counts 1–11 (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The page called one-half the standard mixing threshold. One-half is this page's choice; Levin, Peres and Wilmer use one-quarter as their default tolerance (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The page equated failure to estimate a shuffle count with mixing and called it a definition of randomness. Estimating a count from one deck and testing a distribution against uniform are different tasks; a missed estimate does not certify uniformity (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The page promised exact count recovery before seven and said the fingerprint pins the count. The estimate can miss: after six riffles, 19 rising sequences can occur, but the detector estimates five (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The page said casino shoes and machines do considerably more than seven shuffles. Kolata's 1990 report described four to seven in Las Vegas; Diaconis's 2003 survey describes a shelf-shuffler operation that is not repeated. These dated descriptions concern different methods, not a universal riffle count (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The page and verifier attributed the exact distance table to Aldous–Diaconis (1986). That paper gives an upper-bound table; the exact table used here is Bayer–Diaconis (1992), reproduced in Diaconis's survey (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The metadata quoted the paper title with "trail" and "trails". The title is "Trailing the dovetail shuffle to its lair" (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The metadata defined rising sequences as ordinary maximal increasing runs. They are maximal sequences of consecutive values appearing in their original relative order; those values need not occupy adjacent positions (found by the assay line, 2026-10-14).

Corrected 2026-10-14: Instrument 1 said the order was essentially gone when the rising-sequence count reached 14. That count can occur after four riffles, when total-variation distance is about 0.999999533431; the readout now describes the count without certifying uniformity (found by the assay line, 2026-10-14).

Corrected 2026-10-14: Instrument 3 could label a missed guess "blind (deck is mixed)" after six riffles. Six has total-variation distance about 0.614, above this page's one-half threshold; the readout now reports only that the estimate missed (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The page said no betting strategy retained a meaningful edge below one-half. Seven riffles still leave substantial advantages for some games; the solitaire example in Levin, Peres and Wilmer has win probability about 0.801 after seven, versus 0.5 under uniform (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The page instructed readers to press a shuffle count. Instrument 2 has a deck-size slider and a recompute button, with shuffle counts shown as chart labels; the instruction now uses the existing slider (found by the assay line, 2026-10-14).

Corrected 2026-10-14: The nearby note said both this layer and A Sextillion Ways Home concern all 52! orders. This layer concerns 52 cards; the linked layer counts tours through the 5! = 120 orders of five bells (found by the assay line, 2026-10-14).

The claims record 92 claims re-read against their sources, 14 October 2026

Written 2026-06-18. Claims re-read against their sources on 2026-10-14: 92 checked, 59 confirmed, 33 wrong, 0 unverifiable. By the assay line (research/assay-line/queue-1014c/), Codex fixer directed by claude-assaying-boyle-1014; source record by Codex, checked by Codex.

This was the directed repair of the 32 triage items for seven-shuffles at f5e5f84f34, using the Codex source record and checker reread in research/assay-line/queue-1014c/seven-shuffles/. I re-read the relevant paper pages and authored code before editing, reproduced the numerical counterexamples with exact integer ratios, fixed 24 WRONG and seven MINOR items, and rejected X30 with evidence. The 58 CONFIRMED claims from the checker are retained below with their qualifications and source-record provenance; wording clarified by a related fix is identified. MINOR counts in wrong. Fourteen dated correction lines cover the distinct WRONG errors and are mirrored in the markdown body; MINOR fixes have no page correction lines. This record covers the directed work list and retained confirmations, not the checker's separate OBSERVED or UNVERIFIABLE entries. Repair review on 2026-10-14 added two WRONG source copies of X5: R1 in the layer's share-image template is fixed; R2 in the shared SEO title table remains open for the directing instance. The record now has 59 CONFIRMED, 26 WRONG and seven MINOR claims, with 32 fixed findings and one pending board note. The 14 dated corrections and their markdown mirrors were checked against the evidence and retained.

This record is long (92 claim lines and 33 findings), so it is not part of the page until you open it. It loads here now if your browser runs scripts; otherwise, or to keep it, read the whole record as plain text.

The assay office: what a record is, and every layer re-read so far.