The Deck Looks Shuffled. It Isn't.
The last two posts counted how many shuffles a deck needs, for the overhand shuffle and for a neat dealer's riffle. "Needs" there has a strict meaning: across every way the shuffles could have gone, the spread of possible orders is close to what a perfectly random shuffle gives. No single deck can show you that. You only ever hold one.
What you can do with one deck is test it. Below are three standard tests, and a deck you can shuffle yourself. Behind it, 2,000 more decks get exactly the same kind of shuffle, so you can see how often a deck passes. For two of the shuffles the tests are a fair guide. For the neat riffle they are fooled badly.
Your deck after each shuffle
Share of 2,000 decks shuffled the same way that pass all three tests
Dotted line: shuffles actually needed, โ
The three tests
Each one looks for a pattern a particular shuffle leaves behind. For a random deck, about 95% of decks fall inside each test's range.
- Rising sequences. Start at card 1 of the fresh order, find it, then look further down the deck for card 2, then 3, and so on, until the next card sits above you. Each time you have to go back to the top, a new rising sequence starts. A fresh deck has 1. One riffle gives at most 2, and k riffles at most 2k. A random deck has about 26.5, and passes with 23 to 31.
- Neighbours. How many of the 51 pairs that started next to each other still touch, in either order. The overhand moves cards in packets, so it keeps them together. A random deck averages about 2 and passes with 4 or fewer.
- Pairs out of order. Of the 1,326 pairs of cards, how many are in the opposite order from the fresh deck. A random deck averages half, 663, and passes with 540 to 786. A deck that's been flipped over in big chunks fails it.
When the tests are right
Sloppy riffle (the textbook model). After 5 shuffles only 4% of decks pass all three; it's the rising-sequence test that catches them, since 5 riffles leave at most 32 and usually about 20. After 6 shuffles 53% pass, after 8 it's 85%, and from 9 on it's the random rate. The exact answer, for a distance from random below 0.25, is 8. Tests and truth agree to within a shuffle.
Overhand with 10-card packets. After 20 shuffles 8% pass, after 30 it's 57%, after 50 it's 85%. The neighbours test does the catching: an average of 7.8 original pairs still touch after 20 shuffles. My simulation in the overhand post put the answer at 31 to 40. The tests lag a little here, but they're in the right range. With 2-card packets the pairs-out-of-order test takes over: after 100 shuffles only 3% of decks pass it, because each shuffle mostly turns the deck upside down and the next one turns it back.
When they're fooled
Now the neat riffle, the kind a dealer does: cut near the middle, then let the cards fall almost strictly one from each side. At 99% alternation:
- after 4 shuffles, 0% pass;
- after 5, 86% pass, one point below a truly random deck;
- after 6, back down to 21%;
- after 7, 67%, and after 10, 81%;
- after 15, 87%. The tests can no longer tell these decks from random.
But the counting argument in the last post proves these decks need at least 29 shuffles. It doesn't depend on any test: a riffle this neat makes so few random choices that, after 15 shuffles, the deck almost always lands in a tiny fraction of the 52! possible orders. It just isn't a fraction any of these three tests can see.
At 90% alternation it's even odder. After 5 shuffles, 93% of decks pass all three tests, more than the 87% of truly random decks. The deck looks more random than random. That's a tell in its own right, but only if you look at many decks. With one deck in your hands, it just looks shuffled.
The reason is that a near-perfect riffle is close to a fixed rearrangement, the perfect "faro" shuffle that magicians practise. Repeat it a few times and cards end up spread evenly through the deck, with old neighbours far apart and order mixed in the way these tests measure. The order is still almost completely determined by where you started. It's spread out, not mixed up.
So a test that passes only means it didn't find the pattern it looks for. For the sloppy riffle and the overhand, the patterns these tests look for are the ones that matter, and they track the real answer within a shuffle or two. For a dealer's riffle they don't, and you'd need a test built for that shuffle's own structure to see it.
The widget uses the same shuffle models as the two earlier posts. Its "random" ranges come from 50,000 decks shuffled perfectly at random; the pass rates quoted above come from 20,000 decks per setting.