A 52-card deck can be arranged in 80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000 ways, about 8.07 × 10⁶⁷. Exactly one of them is the factory order. That lopsided count is the whole explanation of why shuffling makes a deck messy and never makes it neat again, and it’s the same counting that underlies entropy in physics. Running the numbers for coins, for a deck, and for real riffle shuffles shows how disorder wins, and exactly how many shuffles it takes to win completely.
Microstates and macrostates
Two levels of description
A microstate is a complete description of a system: which side every coin shows, which card sits in every position. A macrostate is a coarse summary: “50 heads,” “the deck is in new-deck order,” “the deck looks random.” Many microstates usually belong to the same macrostate.
Boltzmann’s count
In statistical mechanics, a macrostate’s entropy is S = k ln W, where W is the number of microstates that produce it and k is Boltzmann’s constant, defined in SI units as exactly 1.380649 × 10⁻²³ joules per kelvin. More ways means more entropy.
Why systems drift toward high entropy
If every microstate is equally likely, a system wandering among them spends almost all its time in the macrostates that have the most microstates. Nothing pushes it toward disorder; there’s just vastly more disorder to be in. The same logic works in reverse for any single microstate: the perfectly ordered arrangement is exactly as likely as any one specific jumbled arrangement. What’s rare isn’t any particular order but the whole category of orderly-looking ones.

A hundred coins
Counting the ways
Toss 100 fair coins. There are 2¹⁰⁰ ≈ 1.27 × 10³⁰ possible outcomes, all equally likely. Exactly one gives 100 heads. The number giving exactly 50 heads is C(100, 50) ≈ 1.01 × 10²⁹.
| Macrostate | Microstates | Probability |
|---|---|---|
| All 100 heads | 1 | 7.9 × 10⁻³¹ |
| Exactly 50 heads | 1.01 × 10²⁹ | 0.0796 |
| Between 45 and 55 heads | 0.7287 |
Bigger systems, sharper peaks
The share of outcomes landing within 45 to 55 percent heads grows quickly with the number of coins:
| Number of coins | Probability heads fall between 45% and 55% |
|---|---|
| 10 | 0.451 |
| 100 | 0.729 |
| 1,000 | 0.9986 |
| 10,000 | more than 0.999999 |
From coins to molecules
A glass of air has something like 10²² molecules, not 10,000. At that scale, the near-even macrostates contain essentially every microstate there is. That’s why a gas fills its container evenly and never gathers in one corner by chance: the corner macrostate exists, but its share of microstates is too small to ever show up.
The deck
Counting orders
A deck of 52 distinct cards has 52! orderings, about 8.07 × 10⁶⁷. Its “entropy” in Boltzmann’s units, if each order is treated as a microstate, is k × ln(52!) = 1.381 × 10⁻²³ × 156.36, about 2.16 × 10⁻²¹ joules per kelvin. That’s a tiny number in thermodynamic terms, which is why card order plays no role in a deck’s physical thermodynamics. The counting principle, though, is identical.
Ordered versus disordered
New-deck order is one microstate out of 8.07 × 10⁶⁷. “Looks shuffled” covers nearly all the rest. A thoroughly shuffled deck lands in factory order with probability 1 in 8.07 × 10⁶⁷. Even at a trillion shuffles per second, going through 52! orders would take about 2.6 × 10⁴⁸ years.
Each well-shuffled deck is almost certainly new
The same number means that any thoroughly shuffled deck is almost certainly in an order no deck has been in before. The number of decks ever shuffled is negligible next to 10⁶⁸.

How many riffle shuffles it takes
The question
A single riffle shuffle, cutting the deck in two and interleaving the halves, can’t reach most of the 52! orders. How many riffles before every order is about equally likely?
Bayer and Diaconis
Dave Bayer and Persi Diaconis answered this in “Trailing the Dovetail Shuffle to Its Lair,” published in the Annals of Applied Probability in May 1992. Using a standard mathematical model of riffle shuffling, the Gilbert–Shannon–Reeds model, they computed how far the deck’s distribution is from perfectly uniform after each shuffle, measured by total variation distance, where 1 means completely unmixed and 0 means perfectly random.
Recomputed here
Their formula depends on counting “rising sequences,” runs of cards still in their original relative order, which riffle shuffles can only break up gradually. Computing it exactly with Python’s integer arithmetic, using the Eulerian numbers that count permutations by rising sequences, gives:
| Riffle shuffles | Total variation distance |
|---|---|
| 1 to 4 | 1.000 |
| 5 | 0.924 |
| 6 | 0.614 |
| 7 | 0.334 |
| 8 | 0.167 |
| 9 | 0.085 |
| 10 | 0.043 |
These match the paper’s Table 1 digit for digit.
Reading the shuffle table
Nothing happens, then everything does
For the first four shuffles the distance stays at its maximum: the deck is still detectably far from random. Then it drops sharply, halving with each further shuffle. This sudden transition, from obviously ordered to nearly random over just a few steps, is the behavior the paper describes.
Why seven
Seven is where the distance first falls to about a third, past the steep part of the drop. Each further shuffle halves what’s left. That’s the origin of the familiar advice to riffle a deck seven times. It isn’t a magic threshold where the deck becomes perfect; it’s the point where diminishing returns set in.
What fewer shuffles leave behind
After four or five riffles, a deck still has long rising sequences, stretches of cards in their original order interleaved with others. A card player who knows the deck’s prior order can exploit that. The entropy counted by the formula hasn’t reached its maximum, because the shuffled deck is still confined to the comparatively few orders a handful of riffles can produce.

Watching it happen in simulation
Twenty thousand decks
The exact table is one way to see the transition. A second is to shuffle decks and watch. A script started 20,000 decks in factory order and riffled each one ten times, using the same Gilbert–Shannon–Reeds rule: cut at a binomially random point, then drop cards from each half with probability proportional to the half’s remaining size.
Two things to watch
After each shuffle it recorded the average number of rising sequences per deck, and how often the original top card was still somewhere in the top quarter of the deck. For a perfectly random deck, the average number of rising sequences is 26.5, and the top card lands in the top 13 positions a quarter of the time.
| Riffles | Average rising sequences | Original top card still in top 13 |
|---|---|---|
| 1 | 2.0 | 100% |
| 2 | 4.0 | 97.6% |
| 3 | 8.0 | 82.5% |
| 4 | 14.1 | 59.3% |
| 5 | 19.6 | 41.9% |
| 6 | 22.9 | 33.0% |
| 7 | 24.7 | 28.9% |
| 8 | 25.6 | 27.3% |
| 10 | 26.3 | 25.5% |
| Random deck | 26.5 | 25.0% |
The fingerprint fades on schedule
Each riffle can at most double the number of rising sequences, which is why the count goes 2, 4, 8 for the first three shuffles. Around the fifth and sixth riffles the doubling stops, as the count runs into the random-deck ceiling of about 26.5. The top card tells the same story: after four riffles it’s still in the top quarter almost 60 percent of the time, a large and exploitable bias, and by seven it’s within four points of the random value.
Why disorder doesn’t reverse
One-way odds
A riffle shuffle doesn’t prefer disorder. It just moves the deck among orders, and there are overwhelmingly more disordered orders to move to. Starting from factory order, the deck spreads out over the 52! possibilities. Starting from a random order, the chance that further shuffling returns it to factory order is 1 in 8.07 × 10⁶⁷ at each step.
The same reason heat flows one way
Physical systems behave the same way, with far larger numbers. Gas molecules spreading through a room, heat flowing from a hot cup into cooler air, ink diffusing through water: each moves from a macrostate with relatively few microstates toward one with vastly more. The laws governing individual collisions run equally well forward and backward. The statistics don’t.
Counting is the explanation
Entropy often gets described as “disorder,” which can sound vague. The calculations here show it’s a count. Seven riffles, 52! orders, 10²⁹ ways to get 50 heads: the second law of thermodynamics is what those numbers look like when the counts become astronomically large.
Sources
- Dave Bayer and Persi Diaconis, “Trailing the Dovetail Shuffle to Its Lair,” The Annals of Applied Probability 2(2), 294–313 (May 1992), PDF hosted at UC Berkeley: https://www.stat.berkeley.edu/~aldous/157/Papers/bayer_diaconis.pdf
