The Best Way To Shuffle A Deck Of Cards, According To Math

The Best Way To Shuffle A Deck Of Cards, According To Math



Card shuffling, assuming a standard deck of 52 cards, is just about one of the most randomizing things you can do, in theory. There are famously so many different possible permutations that it would take more seconds than have elapsed since the Big Bang to deal them all, even if you enlisted the help of a supercomputer.

But theory and practice are two different things. When you actually shuffle a deck of cards, chances are you’re going to see some familiar runs when you deal them – areas where the mix isn’t quite as even as you intended. So, what’s the best way to shuffle a deck to get a proper spread? Is the key in technique, or tenacity? The answer, like so many things in life, all comes down to math.

How to shuffle cards

As anybody who’s ever been tricked into a round of 52-card pickup knows, there’s more than one way to mix up a deck of cards. There’s the “overhand shuffle”, which you’re likely familiar with: it’s “the shuffling technique where you gradually transfer the deck from, say, your right hand to your left hand by sliding off small packets from the top of the deck with your thumb,” wrote Johan Jonasson, a professor of Analysis and Probability Theory at Chalmers University of Technology in Sweden, in a 2006 paper on the method. 

It’s probably one of the easier shuffles to learn, but in terms of randomizing things, it could be better. According to Jonasson, it mixes the cards in a time that’s of order n2logn – in other words, however many cards you have, it takes more than that amount of time squared to get them mixed up properly. 

Given that a standard deck has 52 cards, that makes for a lot of shuffling. “For the overhand shuffle, you need thousands of [iterations],” explained Jason Fulman, Professor of Mathematics at USC Dornsife, in 2023.  “In fact, maybe closer to 10 or 11,000. So it’s a very poor method.”

Rather better for shuffling is the “riffle” – where you cut the deck roughly in half, then let the two piles drop almost card-by-card on top of each other and recombine them. Not only is this one more visually impressive than the overhand method, but it also mixes the cards much more efficiently: in the order of 3/2 logn.

That’s a lot quicker than the overhand shuffle. “Rule of thumb is you need about seven,” Fulman said – more than you’re probably doing before every card game, but much fewer than the five-digit number of shuffles needed for the alternative. 

“One way to explain it […] is, if a deck is perfectly mixed, you can only guess about four and a half cards correctly,” Fulman explained. “If you do a riffle shuffle once, you can guess over 30 cards; if you do it twice, you can guess over 19 cards, and if you do it three times, you can guess almost 13 cards correctly.”

If that figure seems to be decreasing suspiciously slowly, you’re not exactly wrong – but a neat feature of this result, discovered by mathematicians Dave Bayer and Persi Diaconis back in 1990-ish, is its “cut-off phenomenon”: “the randomization arrives abruptly,” noted a 1999 paper by two mathematicians sharing one name, so that “after 1.4 log2 n shuffles, for large enough n, the deck is nowhere near random.”

What that means in practice is this: if you want to mix those cards properly, you need to do all seven rounds of shuffling. 

“Most people shuffle cards three or four times,” Diaconis told the New York Times back in 1990. “Five times is considered excessive.”

But that’s just not enough, he explained; it leaves you with a deck that “is far from random.” It’s only once you reach seven or more riffles that the “distance to randomness” – a mathematical quantity defined by Diaconis and Bayer to describe how well the mix can approximate a random order – falls below ½, making it closer to “random” than to “perfectly ordered”.

Oh – and one caveat here: don’t shuffle the cards too well. We know, it sounds counterintuitive – but if you somehow manage to riffle the deck literally perfectly, then that’s almost as bad as not shuffling at all. Want proof? Try it eight times in a row. You’ll end up exactly where you started.

How random is too random?

Throughout this article, we’ve been assuming that more random is somehow “better” – and mostly, that’s true. If you’re playing cards – and assuming you’re not actually trying to cheat – you want their order to be unpredictable; that’s part of the whole point of the game, usually.

But shuffle your cards too thoroughly, and it seems there’s a sort of uncanny valley effect that takes hold. We’re more used to the idea of computer card games these days, but back in the 1970s, when they were first being introduced, people were outraged – not at the intrusion of the technology, or the bucking of tradition, but because the computers were doing it wrong.

At least, that’s what players thought. The more random deals, created by algorithm rather than human hands, threw competitive bridge players for a loop, the New York Times reported back in 1990; used as they were to being able to intuit roughly which cards had been dealt to their rivals, the players were baffled by their sudden disorientation. 

A bridge encyclopedia published around the same time suffered the same backlash. The publishers, Diaconis explained, had “used a computer to figure out odds. For example, given that between my opponents there are seven hearts, what’s the chances that one has four hearts and the other has three?”

It’s precisely the kind of question we’d take for granted using a computer to calculate today – but at the time, it caused a stir. “Some of [the] odds were at variance with expert play,” Diaconis said. “The experts had intuited – correctly – the actual ways the cards were shuffled. People thought the encyclopedia was wrong.”

The moral, then? If you want a random shuffle, choose a riffle, and repeat seven times. But stop after that – or else you might end up burning some bridges. 



Source link

Share:

Facebook
Twitter
Pinterest
LinkedIn

Leave a Reply

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

Most Popular

Social Media

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.

Categories