Unsorting(randomizing) a sequence
Tim Peters
tim_one at email.msn.com
Tue Aug 24 01:45:49 EDT 1999
[Aahz Maruch]
> ...
> Here's another question: I know the *period* of whrandom() is very
> long, but what is the granularity/precision of it?
It combines 3 sequences each of which have no better than 15-bit resolution.
Analyzing the combined effect is tricky. You need to define your requirements
precisely, then write a realistic simulation independent of your app to test
whether your requirements are met. Every non-trivial application of
pseudo-random numbers should do that. Collecting random <wink> info about the
period and resolution is no substitute; e.g., the lattice structure of
random.random may kill you no matter how long its period or fine its
resolution -- or it may be irrelevant. It depends on every detail of your app.
random.random's prime virtue is that it's fast, not that it's especially good
(see Ivan Frohne for a Python implementation of the Mersenne Twister, which is
a much stronger generator that's slower, but not (like md5) dramatically
slower).
one-hour-of-you-testing-will-save-me-two-days-of-thinking-
and-is-a-lot-more-trustworthy-too<wink>-ly y'rs - tim
More information about the Python-list
mailing list