The Tarot of Ideals

A Card Shuffler Script

How many times must a deck of cards be shuffled before it is truly random?  Mathematical models have been developed such as the Gilbert-Shannon-Reeds model to answer this question:

In the mathematics of shuffling playing cards, the Gilbert–Shannon–Reeds model is a probability distribution on riffle shuffle permutations that has been reported to be a good match for experimentally observed outcomes of human shuffling, and that forms the basis for a recommendation that a deck of cards should be riffled seven times in order to thoroughly randomize it.

I wanted to see it for myself.  The following script mimics the actual shuffling of a virtual deck of cards.  It is able to perform both riffle and overhand shuffles, and displays the results graphically so that the randomness or lack thereof is plainly visible.  Each bar represents a card.  The height of each bar shows the distance of the card from its original position, measured in the left-to-right direction.  (The distances wrap around as if the deck was ordered in a circle.)  Siblings are cards that are beside each other according to the original order; about one pair of these is expected in a random distribution.  Cousins are similarly one card away from each other as they were in the original order.  The bars start out colored dark to light from left to right to give a further visual impression of the distribution.

Click the links below to perform any of the shuffles; click repeatedly to shuffle as many times as you want.  “Both” perfoms a riffle followed by an overhand shuffle; it is how I have always shuffled cards.  The Fisher-Yates shuffle is a mathematical randomization that is commonly used in computer programming; it is included to illustrate what an (almost) truly random deck looks like.  Note that the number of siblings and cousins after randomization is usually between zero and two, with occasional higher numbers.


Number of cards: 

riffle  |  overhand  |  both  |  cut  |  Fisher-Yates  |  reset


 

Siblings:   
Cousins:   


Average number of shuffles before siblings are two or fewer

Based on 100,000+ repetitions.

78 cards—

riffle:  7.8
riffle + cut:  7.7
riffle + overhand:  7.0
overhand:  64
overhand + cut:  49

52 cards—

riffle:  7.1
riffle + cut:  6.9
riffle + overhand:  6.0
overhand:  37
overhand + cut:  29

Bottom line:  if you are willing and able to riffle a Tarot deck, seven riffles followed by overhand shuffles should do it.  If you only use simpler methods such as overhand shuffles or cuts, it will take you a very long time to achieve randomness, and you may not want to read the cards by dealing them; fanning them and choosing them individually, or selecting them by cutting the deck, may be more suitable.

When using reversals, I reverse part of the deck before each riffle, to ensure randomness of that aspect as well.


Notes

The riffle shuffle is based on alternating packets of cards.  I riffled a physical deck of Tarot cards 12 times and counted the packet sizes; the first graph below shows their distribution, which I used for the script.  Note that all shuffling methods depend on how “sloppy” you are; I tried to make the riffles almost-but-not-quite perfect.

When I overhand shuffle, I hold the deck in my left hand, pick up the majority of the cards from the bottom of the deck with my right hand, and then toss them down onto the top of the deck in several packets, usually five (essentially cutting the deck into six packets then reversing the packets).  This is a little different from some published descriptions of the overhand shuffle.  Again, the results depend on how sloppy you are; for me, sometimes the number of tosses is four or six.  (And sometimes the cards interweave a little.)  In the script, the number of packets is chosen from the distribution 5, 6, 6, 6, 6, 7, and the packet sizes are randomly varied.

For the position of the plain cut, I used the distribution in the second graph below, which represents the number of cards from the center position.  This is a guess, and intended to account for a certain intentional carelessness in making the cut.  (Learning to cut a deck exactly in half every time, even with your left hand, is not as hard as you might think.)




Alternative requirements for randomness

If you are using a deck to consult the I Ching and are only looking at the color of the suit, and whether a card is a court card (or an ace, with a Tarot deck), the requirements for randomness are less, and fewer shuffles are required.

78 cards—

riffle:  5.9
riffle + cut:  5.6
riffle + overhand:  5.3
overhand:  54
overhand + cut:  38

52 cards—

riffle:  5.4
riffle + cut:  5.1
riffle + overhand:  4.6
overhand:  34
overhand + cut:  22