The Best (and Worst) Ways to Shuffle Cards – Numberphile

Question is How many times do you have to shuffle the cards – a deck of cards – to mix it up I mean by shuffling probably what you mean by shuffling Cut ’em about in half; you go like that; you push ’em together Right and how many times do you have to do that til the cards get all mixed up and uhh.. There’s a practical answer The answer’s about 7 And uh.. And it’s not “I think it” or “it feels that way” It’s a theorem In contrast There’s another way that people shuffle cards Uh.. They shuffle cards this way You’ve seen people shuffle cards that way (Brady: That’s how I shuffle cards) Ok well uh.. And in India, they do it this way It’s the same – you can see it’s the same Little – dropping little clumps one after another And so lots of – some – people shuffle that way And the answer to “how many of those shuffles does it take to mix up cards?” is about 10,000 So It makes a difference Uh.. (Brady: yes) It makes a difference There’s a 3rd way of shuffling cards that is used in tournament poker games And is used in Monte Carlo I call that “Smooshing” So that’s This method of shuffling cards You’ve probably seen somebody do that You might have done it yourself And then you gather them up and hope for the best If you smoosh for a minute uhh.. It passes all the tests we’ve ever thrown at it um.. If you smoosh for 30 seconds It’s sort of on the edge But seems ok And less than that uh.. It starts failing tests And somebody could make money against you Or guess cards right Suppose you had a scheme for shuffling cards One of these schemes And you wanted to think about “Is it working? Is it random? Or What am I talking about?” If it was a few cards Suppose you had 4 cards And you had some scheme for shuffling them I don’t know – some specific scheme You could just try it a lot With 4 cards there are only 24 possibilities The top card could be any of 4 cards The next could be any of 3 That’s 4 times 3 is 12 Times 2 is 24 And then this is forced to go So you could just do it 1000 times And see Do all 24 possibilities occur about equally likely But with 52 cards There are about 10^68 arrangements of a deck of 52 cards It’s more than the number of particles in the universe Ok so one way of defining randomness is to say all arrangements should be about equally likely I’ll say a sort of more practical version of it Suppose that you had a scheme for shuffling cards And then we were playing a card game And you had to guess at the cards 1 at a a time as I turned them over So for example Y’know Take a guess – what do you think the top card is (Brady: 6 of spades) Uh.. maybe upside down Not so bad, Brady, not so bad Uh.. y’know 6, 9, could be Ok, but suppose As in a card game or in a casino The cards were turned up 1 at a time And somebody tried to guess what they were Now We know now That the 9 of spades is out of the deck So you’re not gonna guess that again What do you think the next card is (Brady: Jack of diamonds) mm… not so good ok So No, but of course it’s not so good Your chance of being right on the first card is 1/52 If the cards were perfectly mixed Your chance of being right on the next card is 1/51 Then 1/50 if you have a good memory And if you have a really good memory, if the cards were all turned face up you would know what the last card is for sure It’s the matching 9 If the cards were perfectly shuffled um.. you expect to get 1/52 + 1/51 + 1/50 etc. Right and going through the deck 1 at a time And that adds up to about 4 and a half So, if somebody could remember and was guessing but the cards were well mixed you could get about 4 and a half right on average If you don’t riffle shuffle enough if you riffle shuffle 4 or 5 times somebody can get 9 or 10 cards right on average Anybody would say that’s not random Riffle shuffle is this guy You riffle ’em together is the way we say it They sometimes do it on the table this way Y’know Casino dealer will do..will do that That’s riffle This is called overhand and the other one I call smooshing I wanted to say it’s not just experimental that gives us these numbers I gave you 7 shuffles It’s math and I wanted to try to explain a theorem and I think this is one that I can explain without writing anything down Let’s see if I make it I’m gonna take A very simple shuffle Which is take the top card off And put it in at random You might put it back on top You might put it back 2nd from the top You might put it on the bottom It’s intuitively obvious that if you did that alot The cards would get all mixed up I mean it’s a silly way of shuffling But it is like a riffle shuffle where you just happen to have cut off 1 card Y’know I’m riffle shuffling this 1 card into this big deck Putting it in at random The deck starts out in order Yknow ace of spades, 2 of spades, 3 of spades whatever and there’s some card at the bottom I’m gonna suppose it’s the king of hearts so the deck is in order, you know the order of the deck It’s in order (Brady: that’s how it came from the pack) yes, yes or you might have written them down the guys in casinos, y’know, record them as they come off right how it came from the pack And now, you’re taking the top card off the and poking it in at random and just do that a lot ok, uh huh, poke poke poke now eventually because of the rules some card will go underneath that original bottom card the king of hearts there it is on the botom eventually if you wait long enough, a card goes under the bottom card how long does that take? well, the chance of a card going underneath the bottom card is 1/52 Because there are 52 places it can go So the chance of that then happening is 1/52 Therefore it takes about 52 pokes on the average to have that happen ok and now , keep going like an idiot and eventually a 2nd card goes underneath the king of hearts when I put that 2nd card underneath the king of hearts so there are 2 card there even if I told you “hey it’s on poke 503” I just poked the 2nd card underneath the king of hearts it’s equally likely that the 2 cards underneath the king of hearts are in order low-high or high-low because I’m poking the card in at random I could have put it above the card that’s on the bottom or below it I’m poking them in at random now, keep poking, eventually a 3rd card goes underneath the king of hearts there are 2 cards previously this one there are 2 cards this one goes in here, here, or here at random so all 6 orders are equally likely every time you put a card in given, as long as you’re putting it in at random the cards underneath the king of hearts are in a completely random order I hope that’s intuitive and it’s true (Brady: that’s make sense) it makes sense and now look at what happens; keep poking the king of hearts slowly moves up it never goes down it might stay where it is if I put a card above it it stays where it is but if i put a card below, it moves up 1 so eventually the king of hearts comes up to the top by induction, by the argument we’ve been doing all the 51 cards are in random order when i put the king of hearts in at random, the whole deck is random exactly random at that moment every arrangement is equally likely so that is not only intuitive it is an exact mathematical fact i hope it makes sense, i think it makes sense and now, you can just ask “how long does that take?” well, it takes 52 pokes for the 1st card to go under there’s the king of hearts on the bottom then i put a card underneath it so now there are 2 places where the next card can go so it’s it it’s 2/52 So it takes 52/2 pokes and then it takes 52/3 pokes for the 3rd card to go under so it’s 52 +52/2 +52/3 and that answer is well it’s – what is it – it’s 52 times log of 52 which is around 200 or so so it takes about 200 of these pokes if you shuffle fewer times if you shuffle 5 or 6 times it really somebody could really make money against you in a card guessing experiment if you shuffle 10 or 11 times it’s not worth the wear and tear on your shoe leather standing there in the casino if you’re counting cards it’s just as close to random as it could be of course it’s never perfectly random y’know we’d have to shuffle infinitely often to make it there’s still some trace of the original order but it vanishes exponentially fast So wonderful question; let me try to match you with an answer the model that the 7 shuffle is based on i’m gonna say it as a slightly more mathy thing

100 comments

  1. Hmm. I alternate a couple riffle shuffles with a couple overhands, and back and forth. I've found that that helps to mix it up better, but maybe that's just because I'm not riffling enough times!

  2. In your 'overhand' method, you have missed the point of that shuffle. It is not place groups from the top to the bottom pile… It is a card or several, from the top AND from the bottom. So, top and bottom one or several immediately combined and moved to the bottom of the second pile. This dramatically increases the shuffle rate to better than riffle. The 'bottom' hand pulls cards from bottom and top as the hands come together, though it may be difficult to see.

  3. That one at a time shuffling he talked so long about is not actually random if a human does it. A human doesnt put cards at random in a deck. Most of the cards just go randomly close to the middle unless the person conscious puts the card at the bottom or at the top.

  4. 2:09 that's less than the estimated amount of atoms in the known universe, which is 10^80, which is more then 10^68.

  5. I'm a computer science student, and as a way of teaching sorting algorithms, my professors often use playing cards as an example. Never learned the best way to shuffle cards so far. I suppose it wouldn't be that hard though when you have some kind of random number generator method

  6. smooshing is similar to the ribbon shuffle where your spread. I noticed overhand didn't randomize, didn't know 10000 times it takes, glad I got rid of doing that solely.

  7. I prefer to use a combination of riffle and overhand. In my experience if you just riffle, the bottom few cards never move up the deck. Similar to the king of hearts in his poke example. My preferred method is riffle + overhand alternating 5 times.

  8. Fun fact: Riffle is not acceptable as a shuffling method since if you can do it perfectly (i.e. split the pack exactly in half and alternate cards) you aren't actually randomising anything – in fact, done properly, you can return the deck to its starting order with only eight riffles.

    Mash and wash shuffling are basically the only truly random methods that cannot be cheated.

  9. I believe that is Professor Persi Diaconis, a professor of Mathematics at Stanford University, who is also very knowledgeable about card magic, and other forms of performance magic.

  10. At 2'02'': 4x3x2x1=24 come on… x is not the multiplication sign ×, and this is hard to mix them up with a serif font ><

  11. 7 riffle shuffles to make a single deck random. How many for say an 8 deck shoe? Same? If it is not fully random, then is it predictable?

  12. I don't like Riffling, by itself, because the top and bottom few fares of the deck rarely move far. Mixing riffles, and say a wash, or even some cuts, I feel is one of the quickest ways to shuffle, yet do so well.

  13. 0:44 I do this, but at the same time I also take some cards from the bottom (got long fingers – women can confirm)
    How does this affect the ratio? cuts it in half?

  14. As a coder, I leave cards unshuffled. Instead, I 'chuffle' (my own word)

    Pick a number between 1->52 and use it, swap the last card into its place. Then pick a number between 1->51, and again, swap the last card into its place. The swaps keep the cards contiguous, allowing a nice 1->x choice. So… the best, most complete and fastest shuffle – is NOT to shuffle ; ) To start a new game, just join the discards pile with the deck in their existing order and chuffle deal a new game.

    So… 'chuffling' … a mixture of the words choose and shuffle ; ) It's a mathematically perfect shuffle in 0 time.

    Actually, since it's actually a dealing method more than a shuffling method, feel free to call it 'duffling' ; )))) But if you see anyone doing it at a live game… leave ; )

  15. so as a guy who plays magic the gathering and plays with decks over 1000 bucks who do i not "riffle shuffle" (the first one) and mix up in a proper way for 60 cards or 100 cards as you normally do not go beyond that

  16. There is also the table shuffling method where you make 4+ piles of cards on the table randomly from the top. I do that plus a few overhand shuffles while cycling my deck in dominion

  17. Putting aside the argument of computer generated random numbers not necessarily being random, the standard way computers shuffe a deck of cards is an interesting means. Essentially, it takes the deck, and then one at a time, goes through each position, first card, second card, third, etc, and picks a position to swap places with.

    So the first card has a 1/52 chance to go right back to the start, but each of the other cards has a 1/52 chance to swap positions with it. And the same goes for all the cards. No slot is off limits, no matter how many times it gets traded, but every position in the deck is guaranteed at least one 51/52 chance to go somewhere else in the deck.

  18. "That's a silly way to shuffle"
    Him describing placing the top card in the deck at random.

    That is really close to how I shuffle. I switch to do it with the cards on the bottom after a minute though.

  19. Doesn't that give the same result as just taking a card from the remaining unshuffled pile and putting it at a random position to the shuffled pile? It's the same method but skipping all steps where cards would be put ahead of the king of hearts. This results in 52 steps which is a log factor less.

  20. If I'm bored or having a conversation and we're not looking to go again quickly I'll typically start making piles, grabbing cards from the top of the deck and decide "randomly" if I want to put them in an existing pile (at "random") or if I want to make a new pile. Typically by the end I have anywhere from 5-10 piles of cards with varying numbers of cards. I then "randomly" decide what order to grab the stacks in, after which I might do a few clump shuffles, and then repeat the first step.

  21. There are more possible combinations in a deck of cards than there are atoms in all of earth. When you shuffle a deck that combination has probably never existed before and will probably never happen again.

  22. YO I was just shuffling around a deck while watching this and when he said 6 of spades I flipped the top one and it was the 6 of spades

    edit The next one was the Jack of diamonds what is this???

  23. Poker dealers at casinos only do 3 riffle shuffles, a "box" shuffle (where you basically just cut about a quarter off the deck, place it down, and repeat 4 times total until the deck is full placed on the table), and then cut the cards roughly in half. This means that the poker cards dealt are very non-random.

  24. 0:06 "what you mean by shuffling" — are we all croupiers here? Can we all riffle shuffle as he does there, with the cards in the air? or at all? Seven times, without any cards ever falling out? Best of luck with that one — we're not all as expert as you.

  25. So I play Magic the Gathering, a card game in wich you usually have your own deck with 60 cards, how many times do I have to shuffle to make it random?
    Also, some people I know shuffle the decks by taking it and making 5 piles of 12 cards each and then just picking them up in a random order, is that mathematically efficient?

  26. I love how this video answers the question and shows all the methods in the first minute and thirty seconds. THANK YOU!

  27. Perfect riffle shuffling will take infinitely long to be random, because perfect riffle shuffling fails to randomize.

  28. Was playing a game of cards with some friends, asked if they could riffle but insisted on doing overhand shuffles… I could link this to them but that'd be rude, instead I can go to bed at night knowing that I wasn't wrong :]

  29. 7 riffle shuffles is incredibly insecure from a player's perspective. The dealer could easily force the top several cards to stay on top by riffling below the top several cards on each riffle, while keeping it looking natural. And, I'm sure a big reason why it takes 7 shuffles is because it's so hard to bring the cards at the top to the bottom when riffling. The cards at the top stay on top and the cards at the bottom stay at the bottom. I would love to see a randomness analysis of the standard riffle riffle box riffle cut that casinos use.

  30. It's not "smushing" bro, it's known as washing the deck. Washing the deck then 3 riffle shuffles is standard at a Poker table.

  31. The numbers when it comes to cards has fascinated me for some time now. Like the fact that if you smoosh the cards properly you will likely have put them in an order that they have never been put in before in the history of cards. That is just mindblowing to me.

  32. Card counters keep count of low and high cards and use this as a prediction of next cards. It doesn't matter how many times it's shuffled. The only problems are cutting card and continuous shuffle machines. But much more easier way is just sitting at full table and predict next cards by analysing the visible cards.

  33. As a casino dealer I mainly do a poker riffle. It goes like this:

    1. Take the unsorted deck. Cut the top third and move it to the bottom. Riffle and combine.

    2. Cut the middle third and move it to the bottom, riffle and combine.

    3. Cut the bottom third and move it to the top, riffle and combine.

    4. Cut the top third and move it to the bottom. Riffle and combine.

    5. Cut the middle third and move it to the bottom. Riffle and combine.

    As you can see, this is only 5 riffles. However, assuming you do a normal riffle without cutting, if you do it card for card with 26 cards in each riffle stack you are putting Ah next to As and so on.

    I wonder what effect the cutting would have on the riffle. I assume quite a considerable difference as the each cut and riffle moves the "to be riffled" cards to a different part of the deck.

    In short, initial riffle makes a much bigger difference, a few cards cut differently on each third makes an enormous difference.

    Thoughts?

  34. 52 log of 52 is definitely not 200. Log of 52 would have to be around 4 if that's true. And log of 10,000 is 4 so….what?

  35. Am I the only one that didn't get how 200 pokes turns into about 7 shuffles? I also saw 3/2 log_2(52) = 8.55 shuffles but that wasn't talked about either…

  36. Is the column direct shuffle better than a riffle? Making, let's say, 5 piles by dealing all the cards then dealing each pile across the remaining piles until you have 2 then combine or riffle.

  37. Wait, for the very last example, if you are intentionally putting one card at a time under the original bottom card in a random order, like was shown in the video, wouldn't that mean you have a perfectly random shuffle after only 52 times

Leave a Reply

(*) Required, Your email will not be published