http://www.perlmonks.org?node_id=441246


in reply to A bad shuffle

Note that in practice, even with a perfect shuffling algorithm not all permutations will have equal probability when using a typical rand() function. The problem is that your typical rand() function uses an integer as a seed, and the number of possible seeds is tiny compared to the number of permutations for "large" lists (where "large" might mean something greater than 12).

For example, if you are shuffling 52 items, you have 52! or about 10^68 permutations. Compare that to the roughly 10^10 values that are possible for a 32-bit integer!

Replies are listed 'Best First'.
Re^2: A bad shuffle
by Anonymous Monk on Mar 22, 2005 at 09:57 UTC
    Fair enough. But people might be using /dev/random or /dev/urandom to generate their random numbers.