Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: A bad shuffle

by itub (Priest)
on Mar 21, 2005 at 17:41 UTC ( #441246=note: print w/ replies, xml ) Need Help??

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!

Comment on Re: A bad shuffle
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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://441246]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2015-01-29 22:59 GMT
Find Nodes?
    Voting Booth?

    My top resolution in 2015 is:

    Results (244 votes), past polls