Here's the best way to shuffle a pack of cards – with a little help from some maths

February 23, 2017 by Graham Kendall, The Conversation
Credit: Shutterstock

Shuffling a pack of cards isn't as easy as you think, not if you want to truly randomise the cards. Most people will give a pack a few shuffles with the overhand or riffle methods (where the pack is split and the two halves are interweaved). But research has shown this isn't enough to produce a sufficiently random order to make sure the card game being played is completely fair and to prevent people cheating.

As I wrote in a recent article about card counting, not having an effective shuffling mechanism can be a serious problem for casinos:

"Players have used shuffle tracking, where blocks of cards are tracked so that you have some idea when they will appear. If you are given the option to cut the pack, you try and cut the pack near where you think the block of cards you are tracking is so that you can bet accordingly. A variant on this is to track aces as, if you know when one is likely to appear, you have a distinct advantage over the casino."

So how can you make sure your cards are well and truly shuffled?

To work out how many ways there are of arranging a standard 52-card deck, we multiply 52 by all the numbers that come before it (52 x 51 x 50 … 3 x 2 x 1). This is referred to as "52 factorial" and is usually written as "52!" by mathematicians. The answer is so big it's easier to write it using scientific notation as 8.0658175e+67, which means it's a number beginning with 8, followed by 67 more digits.

To put this into some sort of context, if you dealt one million hands of cards every second, it would take you 20 sexdecillion, or 20,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, years to deal the same number of hands as there are ways to arrange a deck of cards.

You would think that it would be easy to get a random order from that many permutations. In fact, every arrangement is, in a sense, random. Even one where the cards are ordered by suit and then rank could be considered random. It is only the interpretation we put on this order that would make most people not consider it random. This is the same as the idea that the lottery is less likely to throw up the numbers one to six, whereas in reality this combination is just as probable as any other.

In theory, you could shuffle a deck so that the cards emerged in number order (all the aces, followed by all the twos, followed by all the threes and so on), with each set of numbers in the same suit order (say spades, hearts, diamonds and clubs). Most people would not consider this random, but it is just as likely to appear as any other specific arrangement of cards (very unlikely). This is an extreme example but you could come up with an arrangement that would be seen as random when playing bridge because it offered the players no advantage, but wouldn't be random for poker because it produced consistently strong hands.

But what would a casino consider random? Mathematicians have developed several ways of measuring how random something is. Variation distance and separation distance are two measures calculated by mathematical formulas. They have a value of 1 for a deck of cards in perfect order (sorted by numbers and suits) and lower values for more mixed arrangements. When the values are less than 0.5, the deck is considered randomly shuffled. More simply, if you can guess too many cards in a shuffled deck, then the deck is not well shuffled.

Persi Diaconis is a mathematician who has been studying card shuffling for over 25 years. Together with and Dave Bayer, he worked out that to produce a mathematically random pack, you need to use a riffle shuffle seven times if you're using the variation distance measure, or 11 times using the separation distance. The overhand shuffle, by comparison, requires 10,000 shuffles to achieve randomness.

"The usual shuffling produces a card order that is far from random," Diaconis has said. "Most people shuffle cards three or four times. Five times is considered excessive".

But five is still lower than the number required for an effective shuffle. Even dealers in casinos rarely shuffle the required seven times. The situation is worse when more than one deck is used, as is the case in blackjack. If you are shuffling two decks, you should shuffle nine times and for six decks you need to shuffle twelve times.

Many casinos now use automatic shuffling machines. This not only speeds up the games but also means that shuffles can be more random, as the machines can shuffle for longer than the dealers. These shuffling machines also stop issues such as card counting and card tracking.

But even these machines are not enough. In another study, Diaconis and his colleagues were asked by a casino to look at a new design of a card shuffling machine that the casino had built. The researchers found that the machine was not sufficiently random, as they simply did not shuffle enough times. But using the machine twice would resolve the problem.

So next time you're at a casino, take a look at how many times the dealers shuffle. The may not be as random as you think they are, which could be to your advantage.

Explore further: Spotify deals with random shuffle and us mortals

Related Stories

Spotify deals with random shuffle and us mortals

February 26, 2015

How do we mortals perceive random sequences? An entry in the question-and-answer site Quora focused on a question involving a music-streaming service Spotify. That question signifies how we perceive what is and what is not ...

Researcher uses card trick to reveal unconscious knowledge

November 17, 2011

(Medical Xpress) -- Spanish neuroscientist Luis Martínez of the Institute of Neurosciences in Alicante, has shown that an exception exists regarding “change blindness” and it can be demonstrated by using ...

Gamble on your opponent's gaze if you want to win

June 21, 2016

Blackjack players who hold high-value cards tend to glance fleetingly to the right, whereas those with a lower-value hand do so spontaneously to the left. This is according to research on aspects of mental arithmetic, led ...

HP Adds iPod shuffle to Digital Music Player Lineup

July 1, 2005

Rounding out its lineup of digital music players, HP today added the Apple iPod shuffle from HP. HP is offering two models: the $99.99 512 megabyte version, which holds up to 120 songs, and the $129.99 1 gigabyte version, ...

Apple Introduces iPod shuffle: First iPod Under $100

January 12, 2005

Apple yesterday introduced iPod shuffle, a breakthrough digital music player. Smaller and lighter than a pack of gum, iPod shuffle works seamlessly with iTunes' innovative AutoFill feature, which automatically selects songs ...

Recommended for you

Metacognition training boosts gen chem exam scores

October 20, 2017

It's a lesson in scholastic humility: You waltz into an exam, confident that you've got a good enough grip on the class material to swing an 80 percent or so, maybe a 90 if some of the questions go your way.

Scientists see order in complex patterns of river deltas

October 19, 2017

River deltas, with their intricate networks of waterways, coastal barrier islands, wetlands and estuaries, often appear to have been formed by random processes, but scientists at the University of California, Irvine and other ...

Six degrees of separation: Why it is a small world after all

October 19, 2017

It's a small world after all - and now science has explained why. A study conducted by the University of Leicester and KU Leuven, Belgium, examined how small worlds emerge spontaneously in all kinds of networks, including ...

Ancient DNA offers new view on saber-toothed cats' past

October 19, 2017

Researchers who've analyzed the complete mitochondrial genomes from ancient samples representing two species of saber-toothed cats have a new take on the animals' history over the last 50,000 years. The data suggest that ...

1 comment

Adjust slider to filter visible comments by rank

Display comments: newest first

edshort4
not rated yet Mar 03, 2017
Maybe 25 years ago, Scientific American ran a one-page report saying that the degree of randomness achieved by perhaps 10 riffle shuffles is, more often than not, greater than the randomness after 15 riffle shuffles (something vaguely like that).

Whether a card deck is "random" is not the point, as the present Phys.org article correctly states (assuming no human chose the sequence deliberately, of course). What matters are:
[A] Whether the card sequence contains an "patterns" which have relevance to their purpose of use; and...
[B] Whether a person can predict better than base probability any of the card attributes (value, suit) as they are revealed one-by-one in sequence.

Please sign in to add a comment. Registration is free, and takes less than a minute. Read more

Click here to reset your password.
Sign in to get notified via email when new comments are made.