[Python-Dev] a note in random.shuffle.__doc__ ...
Josiah Carlson
jcarlson at uci.edu
Sat Jun 10 21:52:05 CEST 2006
More information about the Python-Dev mailing list
Sat Jun 10 21:52:05 CEST 2006
- Previous message: [Python-Dev] a note in random.shuffle.__doc__ ...
- Next message: [Python-Dev] a note in random.shuffle.__doc__ ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Alex Martelli <aleaxit at gmail.com> wrote: > > ...claims: > > Note that for even rather small len(x), the total number of > permutations of x is larger than the period of most random number > generators; this implies that "most" permutations of a long > sequence can never be generated. [snip] > I suspect that the note is just a fossil from a time when the default > random number generator was Whichman-Hill, with a much shorter > period. Should this note just be removed, or instead somehow > reworded to point out that this is not in fact a problem for the > module's current default random number generator? Opinions welcome! I'm recovering from a migraine, but here are my thoughts on the topic... The number of permutations of n items is n!, which is > (n/2)^(n/2). Solve: 2**19997 < (n/2)^(n/2) log_2(2**19997) < log_2((n/2)^(n/2)) 19997 < (n/2)*log(n/2) Certainly with n >= 4096, the above holds (2048 * 11 = 22528) - Josiah
- Previous message: [Python-Dev] a note in random.shuffle.__doc__ ...
- Next message: [Python-Dev] a note in random.shuffle.__doc__ ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list