Persi Diaconis: Hustler Turned Mathematician Who Invented the Perfect Card Shuffle

Close Up of Playing CardsBy its very nature, randomness is something that is hard to study and master. After all, if you can spot patterns in a sequence or repetitions in a supposedly random set of events, then they can’t be truly random at all, can they?

That’s a puzzle that Persi Diaconis has spent his lifetime trying to unravel. From scrambling decoded messages to ordering seemingly random strands of DNA, the Greek-American has dedicated his professional life to randomisation as a professor of mathematics and statistics at Stanford University.

But beyond a career in education, Diaconis has also been a trained magician and a card game enthusiast, who according to friends financed his college education by playing – and evidently winning – at poker.

An expert in sleight of hand and putting order to the chaos of random events, Diaconis was always likely to be a person of interest to casinos and the gambling industry as a whole.

And his work would eventually bring a halt to many card counting grifts across the world….

Do You Believe In Magic?

Magician Shuffling Cards

Dai Vernon was a legendary Canadian magician who specialised in card tricks, sleight of hand and ‘up close’ magic – the kind that leaves those who have witnessed first hand agog as to what has just happened.

Vernon gained notoriety in magic circles with his Ambitious Card trick, which sees a marked card return to the top of the deck despite being placed elsewhere. He took to being introduced as the originator of the ‘trick that fooled Houdini’, on account of the fact that the famous escapologist could not figure out how Vernon had performed his Ambitious Card routine.

Such individuals can have a tremendous pull on impressionable youngsters, and that’s perhaps why in 1959 Diaconis, aged just 14 at the time, dropped out of school to travel on the road with Vernon.

A year earlier, the young Diaconis had been frequenting the Tannen’s Magic Emporium in New York City, where he would meet all manner of interesting characters. One of them was Alex Elmsley, a Scottish computer scientist who also moonlighted as a magician.

He taught Diaconis the art of the ‘perfect shuffle’, which essentially splits a deck of cards into two 26-card piles before perfectly interlocking cards from both sets on top of one another, similar to how a zip works on a jacket. It’s a skill the young New Yorker would come back to later in life.

He and Vernon would spent ten years travelling across North America together, with Diaconis developing an interest in magic but also in putting sleight of hand techniques into practice, which he would do in casinos across the United States.

Although details of what he did are somewhat sketchy, it’s thought that Diaconis would find casino dealers that could be ‘encouraged’ to learn his close-up card tricks – perhaps with the aim of grifting poker and blackjack games to profit accordingly.

What Is the Perfect Shuffle?

Suit of Diamonds in Order

The perfect shuffle, in theory at least, would be a completely random way of moving the 52 cards into a wholly unpredictable deck, with any sequences of connected cards (e.g. the three of diamonds next to the four of diamonds) occurring wholly by chance.

But the ‘perfect shuffle’ invented by magicians sees the deck shuffled eight times….with all of the cards incredibly returning to their original order.

It sounds impossible, but a few have mastered it – including Diaconis, who can remarkably perform the perfect shuffle, sometimes known as the Faro shuffle, in under ten seconds. That’s also why he was considered a master of the second card and bottom card deal from his days in poker.

Diaconis has proven many times his ability to perform the perfect shuffle with one simple act: he writes the word ‘random’ along the edge of the cards, shuffling the deck so that the letters are all jumbled up. But then after the eighth shuffle, the cards have magically returned to their original position, with the word perfectly intact.

There are walkthrough videos online teaching the perfect shuffle, but it requires extraordinary hand-eye coordination to be able to accomplish it – and a dose of magic, too, perhaps.

Seven Shuffles Suffice

Number 7 on Chalkboard

Diaconis worked out a way to perfectly shuffle a deck of cards using eight movements.

And he also originated the perfect randomised shuffle, which he could achieve with seven shuffles of the cards.

These seven ‘riffles’ are enough to re-order a deck of cards sufficiently for the next hands to be dealt completely at random, and the practice was implemented by casinos in the days prior to automatic shuffling machines.

The riffle shuffle is more a matter of technique than magic, with the two piles of cards spliced together in perfect motion using dextrous finger movement, rather than sleight of hand or mystical powers.

But the two half decks are reintroduced in completely random places, which ensures that each hand dealt is completely different to the last – or, if it similar, then it’s the chaos of variance at work.

All of this has been confirmed by the Markov chain, a mathematical system which discovered that less than seven shuffles was too few to create randomness, while any more than seven had no additional impact on the unpredictability of the cards.

Diaconis’ riffle technique would change the face of casino gaming, and make life almost impossible for those that had been making considerable profits from counting cards.

Game Changer

Blackjack Table

In days gone by, casino dealers would shuffle the cards two, three or four times, which was taken as read to be sufficient in creating randomness in the deck.

But as Diaconis discovered, seven is the magic number as far as shuffling cards is concerned – anything less and the deck may contain patterns and sequences that the sharpest of minds can predict and exploit.

And that’s exactly what happened in the early 1990s, when gangs of students from Harvard and the Massachusetts Institute of Technology (MIT) started taking down blackjack games across America.

They used the hi/lo system, and other card counting techniques, to detect when decks weren’t being shuffled properly. A company, Strategic Investments, was set up legendary card counter Bill Kaplan so that they could take full advantage – which, all told, they did to some tune.

After learning of their vulnerability, casino bosses began desperately searching for a solution to stop their profits being eroded. They began considering the possibilities of automatic card shuffling machines, but they weren’t sure if these would achieve the sufficient level of randomness required.

Diaconis was called in to examine the machines, and their ability to shuffle a deck with just one pass through of a dealer feeding cards into them. Known as the ‘black box’, Diaconis got to work.

And he, alongside Stanford colleague Susan Holmes, found that the machines – which were set to be rolled out across Las Vegas – had one fatal flaw. The shuffling mechanism would create the same rising and falling pattern each time, meaning that the order of the cards could be predicted based upon the sequence in which they were fed into the shuffler.

In one test study, Diaconis and Holmes managed to accurately guess either nine or ten correct cards per playthrough of the deck – a success rate of around 20%, which would have failed in the bid to eradicate card counting.

Rather than keeping their findings to themselves and making a mint in Sin City, Diaconis and Holmes admitted to the casinos that the shuffling machine prototype was flawed, and they promptly ordered their engineers to work on a different system instead.

You can still count cards in the casino if you put so many hours of research and practice in. But for Persi Diaconis – magician, mathematician and good Samaritan – the process would be a whole bunch easier and more profitable.