Alex Martelli 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. > >Now -- why would the behavior of "most" random number generators be >relevant here? The module's docs claim, for its specific Mersenne >Twister generator, a period of 2**19997-1, which is (e.g.) a >comfortable >130128673800676351960752618754658780303412233749552410245124492452914636 >028095467780746435724876612802011164778042889281426609505759158196749438 >742986040468247017174321241233929215223326801091468184945617565998894057 >859403269022650639413550466514556014961826309062543 times larger than >the number of permutations of 2000 items, which doesn't really feel >to me like a "rather small len(x)" in this context (what I'm most >often shuffling is just a pack of cards -- len(x)==52 -- for example). > >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 think the note is still useful, but the "rather small" wording should be replaced by something most precise (such as the value of n=len(x) where n! > 2**19997).
Raymond _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com