Math — and some clever simulations — have revealed how many shuffles are required to randomize a deck of 52 cards, but there’s a bit more to it than that. There are different shuffling methods, and dealing methods can matter, too. [Jason Fulman] and [Persi Diaconis] are behind the research that will be detailed in an upcoming book, *The Mathematics of Shuffling Cards*, but the main points are easy to cover.

A riffle shuffle (pictured above) requires seven shuffles to randomize a 52-card deck. Laying cards face-down on a table and mixing them by pushing them around (a technique researchers dubbed “smooshing”) requires 30 to 60 seconds to randomize the cards. An overhand shuffle — taking sections from a deck and moving them to new positions — is a staggeringly poor method of randomizing, requiring some 10,000-11,000 iterations.

The method of dealing cards can matter as well. Back-and-forth dealing (alternating directions while dealing, such as pattern A, B, C, C, B, A) yields improved randomness compared to the more common cyclic dealing (dealing to positions in a circular repeating pattern A, B, C, A, B, C). It’s interesting to see different dealing methods shown to have an effect on randomness.

This brings up a good point: there is not really any such a thing as “more” random. A deck of cards is either randomized, or it isn’t. If even two cards have remained in the same relative positions (next to one another, for example) after shuffling, then a deck has not yet been randomized. Similarly, if seven proper riffle shuffles are sufficient to randomize a 52-card deck, there is not really any point in doing eight or nine (or more) because there isn’t any such thing as “more” random.

You can watch these different methods demonstrated in the video embedded just under the page break. Now we know there’s no need for a complicated Rube Goldberg-style shuffling solution just to randomize a deck of cards (well, no *mathematical* reason for one, anyway.)

“If even two cards have remained in the same relative positions (next to one another, for example) after shuffling, then a deck has not yet been randomized. ”

If the two cards moved relative to each other at any time during the shuffling process, I would have to say that the randomization has still been achieved.

For it to be random than all arrangements of cards are equally likely. So sometimes cards would have to end up in the same relative position. Granted that should happen alot less than other arrangements.

Honestly, even if they never moved (i.e. the deck was randomized and ended up in the exact same configuration by chance) it would still have been randomized. Excluding arbitrary edge-cases based on the author’s feelings makes it less random, not more.

That is really going to be down to how you define random – move any one card to anywhere else you have a new and random deck, it just happens to be a near match to the deck it came from. That wouldn’t make for particularly great card games in most cases, being rather too similar to the old stack you really can ‘cheat’ if you knew the old stack. But it is still arguably a perfectly random deck.

For card games in general I would suggest it really doesn’t matter much how many cards never get split from their neighbour at the start through the whole deal as long as there actually shuffles going on – split a stack into 6 bits of any card count and stack them up in a different order should be really quite adequate for most card games even with the players avidly watching the dealer they can’t be sure if any particular card they are tracking was actually in group 1,2 or 3 of that initial split most of the time, and even if in this case it was easy to judge which group it went in and get a good idea of how deep down the stack it went you still can’t be sure if its the 3rd card or the 7th, which once you then start dealing… It could easily be in just about any players hand, the next card to draw or 3 cards deeper (etc) – for most card games that is already enough that trying to track the cards based on the previous decks movements through a shuffle is of little gain, as the uncertainty is high enough.

That highly depends on the Gameboy Player i guess. Imagine a game of Poker. If in the last round a paar of aces were shown, knowing that these two endetd up in the bottom of the Stack after shuffling makes a huge difference, especially if you now got the other 2 aces in your Hand…

I would define a shuffling method as “randomizing” only if each card has the opportunity to be moved from its prior position relative to those beside it. So selecting the top card and moving it to the bottom of the deck fails that definition, though the deck is uniquely different from the previous “shuffled” deck, fails that test. You’d have to move a certain percentage of cards in a normal distribution for the deck for me to consider it shuffled… Meaning some cars will be moved many times, and very few would not be moved.

I play a few games of Klondike solitaire every morning along with my coffee and shuffling the deck is an important part of the ritual.

It seems to get easier to win after 3 games, especially if I haven’t done a good job shuffling after collecting the cards. I’ll start with a “smoosh” style then do a few riffles but I don’t cut the cards from the top, I’ll take my cut, about half the cards, from the middle. After those riffles I’ll deal either the top 26 cards out so the order is reversed and I’ll finish with a few more riffles. In all I get about 7 total shuffles that feel like the deck is really mixed up.

I’ve played around to develop this ritual by turning over the aces in the deck so they are easy to track as I shuffle. It’s fun to see how the turned over cards move around the deck and how I can influence their arrangement.

Not very scientific but it works for me.

I admit, I’m too lazy to calculate now what is the chance that there are NOT two cards at the same place after shuffling. That would be interesting. But I don’t get this argument with the 2 cards anyway. If you have a nonrandom deck of cards and place the first card at the last place, all cards have a different place than before but that’s hardly random.

I believe they’re saying that 2 cards that were neighbours in the original deck should at some point be separated during the shuffle, or you’ll be keeping some small subsets of cards in the same order

I think this statement is about the shuffle, not the definition of random. If you use a shuffle that leaves two cards in their original position then you have a repeatable and predictable error and a shuffle that can not randomize.

With a truly random shuffle it is possible, albeit very unlikely to end up with every suit grouped together and to have every card within the suit in order. It however isn’t any more unlikely than any other combination of cards.

Diaconis was on Numberphile a few times 8 years ago talking about this. It’s not a surprise that he’s talking about the same thing–it’s his area of research–I’m just not sure if what he’s saying now includes anything newer than what he was saying. https://youtu.be/AxJubaijQbI

The seven shuffle thing is definitely an old result of his. I saw him present it when I was a math grad student, so before 1997.

I remember confidentially talking about seven shuffles in the early 90s. It’s a well known result.

As is that you need ~ one more shuffle for randomness as the deck size doubles and one fewer as it halves. (possibly with another base to be more accurate, but shuffling requirements are logarithmic).

An important factor to consider is what the intention is of shuffling the cards.

It’s been over 30 years since I played a card game myself, but back then my parents shuffled the cards quite briefly. Just enough to make the outcome unpredictable to humans, but not good enough to completely destruct the order of the cards from the previous game. This made the card game more interesting while still keeping it “fair” for everyone. Whether this works is of course also very dependent on the card game you play.

My parents did the same. I always considered that having an opponent of the shuffler cut the deck assured fairness.

They mention the magician who can control the deck with extremly accurate shuffling, I’ve seen it done and it’s a very impressive skill. Then there’s people like me who can’t and big chunks of cards can go by in one. So I’m wondering what their baseline for a riffle is to come out with 7 shuffles for randomness given the skill of the shuffler clearly has a part to play in this. i.e whats the max number of cards from a side that can stick together and how equal does the inital split need to be?

To be fair, the article did specify seven “proper” riffle shuffles, and you’re correct that the shuffler’s skill would matter. I am perhaps the world’s worst, so I can testify to this. But your question inspires a thought that had not occurred to me when I initially read the article…

A riffle shuffle in software ( trivially easy to implement with a few lines of code in any language) can be uniformly perfect. You simply juggle array elements. The completely mechanistic character of this process means that if you started with a card deck with an arbitrary sequence (let’s say for testing purposes, in numerical order) there must be some fixed number (n) of perfect riffle shuffles after which the starting card sequence would reappear. Therefore, algorithmically, the riffle shuffle is not random at all.

What is good about the riffle is its tendency to greatly amplify the effects of unintentional variation introduced by the human shuffler. Thus, if the deck is split unevenly before each of a series of shuffles (even by just one card) the mechanistic apple cart is upended. The same is true if the imperfection of a physical riffle allows the occasional interleave of two cards instead of one.

In the end, where game play is concerned, I don’t think randomness matters at all. What matters is unpredictability, which takes me back to the software (simulated) riffle. If a few iterations of perfect riffle are sufficient to create a sequence the average human could not calculate or predict in their head–even if demonstrably non random– then several iterations of mediocre manual riffle are likely good enough.

In the software version, it would be easy to add a second layer that makes it practically random – say shuffle 0 to 9 times more depending on the last millisecond digit of the local time when the first shuffle program ends its shuffling.

The thing with a perfectly executed riffle is, it loops back to the non-shuffled state pretty quickly. So some added source of randomness is needed; just randomizing the number of riffles isn’t adequate.

Is that you, Vida Brew?! Hope you’re well.

What we tend to do in my family, is to alternate an overhand (IE, very poor) shuffle with a flawless riffle. The riffle is performed manually without bending the cards, because that way we’re not wearing out expensive board game cards. There’s a comparatively fast way do it, transferring two cards at a time from the right hand into the left. So the overhand is injecting a little disorder between riffles.

smooshing ftw

A valid concern! The video shows a riffle shuffle where one side drops two consecutive cards. Does this still count as a proper shuffle?

I would suspect that they hired someone for the video who did not understand the mathematics and dropped in some random footage.

As an engineer, I would start asking about real-world shuffling efficiencies. Give someone a deck of cards, have them shuffle once or more, and then scan the deck to determine shuffling efficiency. Do this a few hundred times…

From my armchair I would…

Have a deck of cards marked with an additional barcode on the front, left and right. Build a machine that scans them quickly and compute the efficiency before and after (no need for sorting!). Go to a bar and see who is the best shuffler – and collect 100s of real world permutations on the way.

Some other comments have mentioned this as well, but if a riffle exactly alternates cards, you get a predictable sequence that returns quite quickly (some factor of 54 shuffles) to the original state, but also is knowable exactly via the number of shuffles. I don’t know what the best distribution of number of consecutive cards per side would be, but hitting 1 every time as opposed to hitting 2 sometimes makes a big difference.

“If even two cards have remained in the same relative positions (next to one another, for example) after shuffling, then a deck has not yet been randomized.”

Incorrect. It’s mathematically possible (and likely not even all that improbable, though I haven’t done the math) for that to happen in a fully random process. It could happen even if cards aren’t involved in the shuffling process at all; the current state of the art in duplicate contract bridge is to generate the hands on a computer and then use a dealing machine to put the cards into the appropriate hands.

Dealing machines are also an interesting (and alas expensive) bit of tech. The first generation required special cards with bar codes, but more recent ones use optical recognition of standard playing cards. Most of the complexity is in the mechanical design of a machine that can reliably handle and sort cards without them ever sticking together and being mis-sorted.

I cannot remember the specifics, and not quite the same situation, but I remember reading about a cryptographic exploit due to the specific PRNG not outputting, or unlikely to output, repeated values in series, more so that truely a random system would generate…

I seem to have know the 7 shuffle rule of thumb for a lot of years. Don’t remember when I picked up on that. I drove my late father-in-law nuts when playing Cribbage as I’d sometimes spend the time to shuffle 7 times :) . Normally one or two was enough for him! Just get on with the game, he’d say!

I distinctly remember my mom telling me it was 7 times when I was learning to shuffle. And that was 35 years ago. There is no way that statistical mechanics was developed in the late 1800’s and no one looked into shuffling cards randomly until today. It’s still a fun exercise though in how to define “random” with any formality.

Well, it’s quite easy to demonstrate that the riffle count has to be at least six. Just look at the top card of the deck. After one riffle, it has to be in one of two places. So we’re dealing with binary. And two to the sixth is the smallest power of two that covers at least all 52 possible positions of that initial top card.

We played a lot of cards growing up, and I was always told that three riffle shuffles would create the perfect amount of randomness, and that any more would actually reduce it, as the cards would end up back in the same relative position they already were at. Not sure why, but this was seen as common knowledge where I grew up.

That’s plausible, of the riffle is performed perfectly, with cards always alternating.

If the ruffles are utterly perfect, eight riffles will leave everything back where it started (with a 52 card deck). But you need seven imperfect shuffles to have every card have an equal chance of being in every position in the deck!

> This brings up a good point: there is not really any such a thing as “more” random.

Shannon Entropy disagrees. If you start with an unshuffled deck, the Shannon Entropy of the deck will be 0. As you shuffle, the value will increase up to the log2(52!). Until you’ve reached that ceiling, you can argue there is such as thing as “more random”.

Someone I knew could do two riffle shuffles and have the deck back in the original order… I think there’s something more to the definition of riffle shuffle to make this claim accurate.

I agree. I think to shuffle properly you need to alternate riffle shuffles with overhand shuffles. Otherwise you could make assumptions about the deck. For example if 4 aces got stacked on the top of the deck at the end of a play. You could riffle shuffle 7 times and be sure those aces are near the top of the deck. And if you have someone cut the deck before dealing and you see it’s half the deck or less from the top, if say four hands of five cards are dealt, then you know there are no aces in anyone’s hand. Hardly random.

There’s a definite upper limit to how shuffled a deck can be; but that’s different than saying there’s no matter of degree. Probability theory is always a matter of degree.

These people have no idea what random is. In fact quantifying how a deck should look after shuffling makes a deck no longer random… The irony.

That’s a silly thing to say – clearly if the deck has probability 1 of being in exactly the same order then you’ve got a bad shuffle. A perfect shuffle would hit each possible permutation uniformly, and you can quantify how close you are to that in a meaningful way. That’s exactly what probability does – quantifies randomness.

This is true, but Im not sure *anyone* knows what random really means. Write the numbers 1,2,3 in random order. By looking at the outcome I have no idea whether you succeeded. I might or might not agree that you used a random process, and 123 would be a perfectly valid result.

https://blogs.sas.com/content/iml/2018/09/24/perfect-riffle-shuffles.html#:~:text=The%20article%20caused%20one%20my,after%20exactly%20eight%20perfect%20shuffles!

8 to go back perfect…. Lots of people can do that, in fact.

I was so glad to see SAS mentioned to figure out the odds. I had to learn a bit of SAS in college, and used it occasionally professionally about 35 years ago. I recently came across a little SAS cheat sheet I wrote back then. Gonna hang onto it just in case ..

Very early on, gonna have to stop you right there. Dealing doesn’t affect the deck, the writer is incompetent.

“If even two cards have remained in the same relative positions (next to one another, for example) after shuffling, then a deck has not yet been randomized.” Whaddaya you know? Another thing that’s not true!

@Anonympus: “Excluding arbitrary edge-cases based on the author’s feelings makes it less random, not more.” I WILL NOT HAVE YOU downplaying, trashing, or implying “less than” the author’s feelings, Sir or Madam or Whatever! The author’s feelings are SCIENCE!

The article author is just shilling for the book and the author’s of the book are just regurgitating old results (in Persi’s case his own results, I don’t know about the other) but I expect it will be a fun book. Not against it in any way. Just find this article disappointing.

@Craig: you’re misusing or misunderstanding the term “statistical mechanics”, it don’t make you a bad person.

@Dranortor: “Probability theory is always a matter of degree.” Therefore, probability theory being a matter of degree has a probability of 1. Note the use of “always”. Therefore, it is not a matter of degree. Discuss.

The paper defines a shuffle.

The deck is split into 2 parts with a pile having randomly from 1 to 51 cards.

The shuffle the probability the bottom card comes from a given pile is equal to the fraction of the remaining cards in that pile.

It is certainly possible for 2 cards to remain adjacent through the entire process.

My intuiution is that real people’s shuffles are less randomizing than the model shuffle.

The following statement from the article gives me the most pause: “A deck of cards is either randomized, or it isn’t. If even two cards have remained in the same relative positions (next to one another, for example) after shuffling, then a deck has not yet been randomized.” The implication seems to be that if I start with cards 1-52 and after shuffling there exists any consecutive cards in the new deck, e.g. 24 & 25, then the deck is not random. But I would argue that knowing any thing about the new deck, e.g. no 2 cards are in the same order is form of bias. I can definitely rule out certain combinations based on information from the previous deck. That means all combinations of cards don’t have the same probability, which seems less random.

I knew seven shuffles was purportedly enough in high school, so 1990 at the latest, and I’m pretty sure Diaconis or someone had by then shown that eight perfect riffle shuffles–not an easy trick to learn–will restore it to its initial state.

We need an Infinite Improbability Shuffle.

Just so you know, the process of dealing randomizes the cards.

Starting with a full deck, “Pick a card! Any card!” (Chosen at random, of course) “Now place it on top of the discard pile.” (Repeat until the deck is exhausted) “Now pick up your discard pile.” (It is completely randomized). “Congratulations! You have just shuffled the deck without bending the cards!”

Hardly.

I did not finish reading through all of the comments, so forgive me if this was already pointed out: play begins the randomization. It’s likely that some games create a greater degree of semi-randomized pre-shuffel conditions than others. Most games that come to mind (for me) are set acquisition games, but where those sets go, how they are returned, and factors such as rotational shuffeling (different players) should result in a variance on the number of shuffles needed for a completely random order from the previously shuffeled deck that started the last round of play.

The article seems to speak to shuffeling a deck, recording its order, then shuffeling again and comparing the new order to the previous order. Even my solitaire play isn’t that static.

“If even two cards have remained in the same relative positions (next to one another, for example) after shuffling, then a deck has not yet been randomized.”

By my math, it’s more likely (64%) that a random deck of 52 cards will have two consecutive cards than not (36%).

It’s easier to figure the not two consecutive: For each of the 52 cards, there are 50 of the other 51 cards that are not consecutive. So ~98% chance that the next card is not consecutive. Continuing this for the 52 cards, it’s 98% times 98% for 52 times or raised to power of 52. So: (50/51)^52 = 0.3571.. or 36% for not two consecutive in the deck, 64% for two consecutive. (Yes, I’m including top & bottom cards in the math).