The faro shuffle (American), weave shuffle (British), riffle shuffle or dovetail shuffle is a method of shuffling playing cards. Mathematicians use "faro shuffle" for a shuffle in which the deck is split into equal halves of 26 cards which are then interwoven perfectly.
Magicians use these terms for a particular technique (which Diaconis, Graham and Kantor call "the technique") for achieving this result. A right-handed practitioner holds the cards from above in the right and from below in the left hand. The deck is separated into two preferably equal by parts simply lifting up half the cards with the right thumb slightly and pushing the left hand's packet forward away from the right hand. The two packets are often crossed and tapped against each other to align them. They are then pushed together on the short sides and bent either up or down. The cards will then alternately fall onto each other, ideally alternating one by one from each half, much like a zipper. A flourish can be added by springing the packets together by applying pressure and bending them from above.
A game of faro ends with the cards in two equal piles that the dealer must combine to deal them for the next game. According to the magician John Maskelyne, the above method was used, and he calls it the "faro dealer's shuffle". Maskelyne was the first to give clear instructions, but the shuffle was used and associated with faro earlier, as discovered mostly by the mathematician and magician Persi Diaconis.
A faro shuffle which leaves the original top card at the top and the original bottom card at the bottom is known as an out-shuffle; one which moves the original top card to second and the original bottom card to second from the bottom is known as an in-shuffle. These names were coined by the magician and computer programmer Alex Elmsley. A perfect faro shuffle, where the cards are perfectly alternated, is considered one of the most difficult sleights of card manipulation, because it requires the shuffler to cut the deck into two equal stacks and apply just the right pressure when pushing the half decks into each other.
The faro shuffle is a controlled shuffle which does not fully randomize a deck. If one manages to perform eight perfect faro out-shuffles in a row, then the deck of 52 cards will be restored to its original order. If one can do perfect in-shuffles, then 26 shuffles will reverse the order of the deck and 26 more will restore it to its original order.
A faro shuffle is not to be confused with a sorting algorithm. A perfect faro shuffle cycles the order of the cards into a fixed number of states. For a 52-card deck using perfect faro out-shuffles there are 8 possible states in the cycle. That is, a faro shuffle can only be used to return the deck to its order prior to faro shuffling; it will not sort a randomized deck, nor can it return a randomized deck to new-deck order (unless the randomized initial state of the deck just happens to be one of the permutations of faro-shuffling a new deck).
Below is a Python 3 implementation of a perfect faro out-shuffle:
#! /usr/bin/env python # -*- coding: utf-8 -*- class Deck(object): def __init__(self): self.cards = [ 'A♠', '2♠', '3♠', '4♠', '5♠', '6♠', '7♠', '8♠', '9♠', '10♠', 'J♠', 'Q♠', 'K♠', 'A♦', '2♦', '3♦', '4♦', '5♦', '6♦', '7♦', '8♦', '9♦', '10♦', 'J♦', 'Q♦', 'K♦', 'K♣', 'Q♣', 'J♣','10♣', '9♣', '8♣', '7♣', '6♣', '5♣', '4♣', '3♣', '2♣', 'A♣', 'K♥', 'Q♥','J♥', '10♥', '9♥', '8♥', '7♥', '6♥', '5♥', '4♥','3♥', '2♥', 'A♥'] def __eq__(self, other): return self.cards == other.cards def faro_shuffle(self): '''Shuffles the deck using a perfect faro shuffle.''' r =  for (a, b) in zip(self.cards[0:26], self.cards[26:]): r.append(a) r.append(b) self.cards = r original_deck = Deck() # A deck in new-deck-order we will use for comparison. shuffled_deck = Deck() # A deck we will repeatedly faro-shuffle. for i in range(1, 1000): shuffled_deck.faro_shuffle() if shuffled_deck == original_deck: print("Deck is back in new-deck order after %s shuffles." % i) break
The program shuffles a 52-card deck until it returns to its original order. This happens in exactly 8 iterations (shuffles):
(prompt)> python shuffle.py
The deck is back in new-deck order after 8 shuffles.
Group theory aspects
More generally, in , the perfect shuffle is the permutation that splits the set into 2 piles and interleaves them:
Formally, it sends
Analogously, the -perfect shuffle permutation is the element of that splits the set into k piles and interleaves them.
The -perfect shuffle, denote it , is the composition of the -perfect shuffle with an -cycle, so the sign of is:
The sign is thus 4-periodic:
The first few perfect shuffles are: and are trivial, and is the transposition .
- Diaconis, P.; Graham, R. L.; Kantor, W. M. (1983). "The mathematics of perfect shuffles". Advances in Applied Mathematics 4 (2): 175–196. doi:10.1016/0196-8858(83)90009-X.
- Ellis, J.; Fan, H.; Shallit, J. (2002). "The Cycles of the Multiway Perfect Shuffle Permutation". Discrete Mathematics and Theoretical Computer Science 5: 169–180. Retrieved 26 Dec 2013.
- Maskelyne, John (1894). Sharps and Flats: A Complete Revelation of the Secrets of Cheating at Games of Chance and Skill. Longmans, Green and Company. Retrieved 26 Dec 2013.
- Morris, S. Brent (1998). Magic Tricks, Card Shuffling, and Dynamic Computer Memories. The Mathematical Association of America. ISBN 0-883-85527-5. Retrieved 26 Dec 2013.
- Morris 1998, 13
- , Diaconis, Graham, and Kantor 1983, 188
- Morris 1998, 111
- Maskelyne 1894, 204
- Morris 1998, 8
- Morris 1998, 11–12
- Diaconis, Graham, and Kantor 1983, 193
- Diaconis, Graham, and Kantor 1983, 191–193
- Ellis, Fan, and Shallit 2002