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. It is named after the work of Edgar Gilbert, Claude Shannon, and J. Reeds, reported in a 1955 technical report by Gilbert and in a 1981 unpublished manuscript of Reeds.
Contents
The model
The Gilbert–Shannon–Reeds model may be defined in several equivalent ways.
Most similarly to the way humans shuffle cards, it can be defined as a random cut and riffle. The deck of cards is cut into two packets; if there are a total of n cards, then the probability of selecting k cards in the first deck and n − k in the second deck is
An alternative description can be based on a property of the model, that it generates a permutation of the initial deck in which each card is equally likely to have come from the first or the second packet. To generate a random permutation according to this model, begin by flipping a fair coin n times, to determine for each position of the shuffled deck whether it comes from the first packet or the second packet. Then split into two packets whose sizes are the number of tails and the number of heads flipped, and use the same coin flip sequence to determine from which packet to pull each card of the shuffled deck.
Another alternative description is more abstract, but lends itself better to mathematical analysis. Generate a set of n values from the uniform continuous distribution on the unit interval, and place them in sorted order. Then the doubling map
Among all of the possible riffle shuffle permutations of a card deck, the Gilbert–Shannon–Reeds model gives almost all riffles equal probability, 1/2n, of occurring. However, there is one exception, the identity permutation, which has a greater probability (n + 1)/2n of occurring.
Inverse
The inverse permutation of a random riffle may be generated directly. To do so, start with a deck of n cards and then repeatedly deal off the bottom card of the deck onto one of two piles, choosing randomly with equal probability which of the two piles to deal each card onto. Then, when all cards have been dealt, stack the two piles back together.
The effect of repeated riffles
Bayer & Diaconis (1992) analyzed mathematically the total variation distance between two probability distributions on permutations: the uniform distribution in which all permutations are equally likely, and the distribution generated by repeated applications of the Gilbert–Shannon–Reeds model. The total variation distance measures how similar or dissimilar two probability distributions are; it is zero only when the two distributions are identical, and attains a maximum value of one for probability distributions that never generate the same values as each other. Bayer and Diaconis reported that, for decks of n cards shuffled
Similar analyses have been performed using the Kullback–Leibler divergence, a distance between two probability distributions defined in terms of entropy; the divergence of a distribution from uniform can be interpreted as the number of bits of information that can still be recovered about the initial state of the card deck. The results are qualitatively different: rather than having a sharp threshold between random and non-random at