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

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 thoughts on “The Best (and Worst) Ways to Shuffle Cards – Numberphile”

  1. 52 factorial is eighty unvigintillion six hundred fifty-eight vigintillion one hundred seventy-five novemdecillion one hundred seventy octodecillion nine hundred forty-three septendecillion eight hundred seventy-eight sexdecillion five hundred seventy-one quindecillion six hundred sixty quattuordecillion six hundred thirty-six tredecillion eight hundred fifty-six duodecillion four hundred three undecillion seven hundred sixty-six decillion nine hundred seventy-five nonillion two hundred eighty-nine octillion five hundred five septillion four hundred forty sextillion eight hundred eighty-three quintillion two hundred seventy-seven quadrillion eight hundred twenty-four trillion

  2. How many Rifle shuffles does it take on average to have the deck return to its original state? For example, where all the cards arrive from the factory in order. How many shuffles does it take (besides 0, haa ha) does it take to return the deck to its factory in order state?

  3. I've learned to riffle the cards and then raise roughly third of the deck from the middle to top after each riffle (which is pretty simple to do simply by pinching from the sides of the deck and pulling the middle part away) before halving the deck again for the next riffle. I think that it improves the changes that the top and the bottom of the deck get mixed during the suffle, but I have no mathematical explanation if it really matters.

  4. How would alternating between riffling and stripping the deck (rearranging 5-7 chunks of cards) change the number of shuffles necessary? In casinos they often use systems like riffle-strip-riffle-strip-riffle. How random is that?

  5. I do overhand and underhand at the same time. The whole calculation as to what randomness means kinda goes weird when you get into how dealing out the cards destroys the chance of old patterns openly appearing.

  6. Hmm, 7 may be the optimal number of shuffles for a regular deck of cards, but what about a deck of 78, plus orientation, which makes the total amount of possibilities 156?

  7. All of these only apply to traditional playing cards. And a TCG you can’t shuffle in ways that bend the cards because those cards can be worth a bit of money. He didn’t even mention pile shuffling.
    Do people even watch poker or other traditional playing card games anymore?l(joke)

  8. 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!

  9. 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.

  10. 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.

  11. 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.

  12. 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

  13. 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.

  14. 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.

  15. 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.

  16. 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.

  17. 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 ><

  18. 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?

  19. 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.

  20. 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?

  21. 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 ; )

  22. 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

  23. 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

  24. 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.

  25. "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.

  26. 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.

  27. 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.

  28. 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.

  29. 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???

  30. 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.

  31. 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.

  32. 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?

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

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

Leave a Reply

Your email address will not be published. Required fields are marked *