Notes

Chapter 7: Mechanisms in Programs and Nature

Section 5: The Intrinsic Generation of Randomness


Card shuffling

Another rather poor example of intrinsic randomness generation is perfect card shuffling. In a typical case, one splits the deck of cards in two, then carefully riffles the cards so as to make alternate cards come from each part of the deck. Surprisingly enough, this simple procedure, which can be represented by the function

s[list_] := Flatten[Transpose[Reverse[Partition[list, Length[list]/2]]]]

with or without the Reverse, is able to produce orderings which at least in some respects seem quite random. But by doing Nest[s, Range[52], 26] one ends up with a simple reversal of the original deck, as in the pictures below.



Image Source Notebooks:

From Stephen Wolfram: A New Kind of Science [citation]