Fisher–Yates Shuffle

The Fisher–Yates shuffle (named after Ronald Fisher and Frank Yates), also known as the Knuth shuffle (after Donald Knuth), is an algorithm for generating a random permutation of a finite set—in plain terms, for randomly shuffling the set. A variant of the Fisher–Yates shuffle, known as Sattolo's algorithm, may be used to generate random cycles of length n instead. Properly implemented, the Fisher–Yates shuffle is unbiased, so that every permutation is equally likely. The modern version of the algorithm is also rather efficient, requiring only time proportional to the number of items being shuffled and no additional storage space.

The basic process of Fisher–Yates shuffling is similar to randomly picking numbered tickets out of a hat, or cards from a deck, one after another until there are no more left. What the specific algorithm provides is a way of doing this numerically in an efficient and rigorous manner that, properly done, guarantees an unbiased result.

Read more about Fisher–Yates Shuffle:  Fisher and Yates' Original Method, The Modern Algorithm, The "inside-out" Algorithm, Comparison With Other Shuffling Algorithms, Potential Sources of Bias

Famous quotes containing the word shuffle:

    Ignore death up to the last moment; then, when it can’t be ignored any longer, have yourself squirted full of morphia and shuffle off in a coma. Thoroughly sensible, humane and scientific, eh?
    Aldous Huxley (1894–1963)