A field guide to card shuffling

Seven Shuffles

A 52-card deck can be in 8.07 × 1067 different orders. Some shuffles reach all of them evenly in seconds. Others take hours, and a few never get there at all. Riffle this deck and watch the order dissolve.

Riffles0so far
Rising sequences1random deck: about 26.5
Still adjacent51of 51 original neighbour pairs
Distance from random1.0000 is perfect, 1 is useless

The distance stays near 1 for four riffles, then falls off a cliff. It first drops below ½ at seven.

What "random" means

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:

80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000

No real shuffle hits each order with probability exactly 1/52!. Mathematicians measure how far off it is with the total variation distance:

d = ½ Σπ | P(π) − 152! |

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.

0 · indistinguishable from random1 · totally predictable
The shuffle lab

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.

By hand

The math model

What it takes

What to watch

Top of deckBottom
Shuffles0 
Rising sequences1random: ≈ 26.5
Still adjacent51random: ≈ 1
Position bias0.98from the heatmap

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.

neveruniform (1/52)certain

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.

Why seven

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:

Pk(π) = ( 2k + n − r choose n )2nk

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.

The scorecard

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.

TechniqueNeeded for 52 cardsGrows likeSourceVerdict
Riffle7 riffles³⁄₂ log₂ nBayer & Diaconis, 1992Use this
Smoosh / wash30–60 seconds½ n ln n swaps (model)Diaconis & Shahshahani, 1981; Diaconis lab testsGood
Top-to-random≈ 236 movesn ln nAldous & Diaconis, 1986Slow
Overhand≈ 10,000 shufflesn² log nPemantle, 1989; Jonasson, 2006Hopeless alone
PileNeverFixed permutationArithmeticNo randomness
Perfect faroNeverFixed permutationArithmeticMagicians 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.