Random numbers

Tim Peters tim_one at email.msn.com
Mon May 22 22:20:57 EDT 2000


[Russell Wallace]
> Is there any difference between the random number generator in the
> 'random' module and that in the 'whrandom' one?

No, but you shouldn't use whrandom:  whrandom is an interal implementation
detail of random.py.  whrandom.py should probably be renamed to _whrandom.py
(or something) to stop people from tripping over it.

> What's the quality

If you know enough about random numbers to understand an answer to that
question, then telling you it's the standard Wichman-Hill (that's where "wh"
comes from) generator is all the answer you need <wink>.  Seriously, test it
and determine whether it's adequate for your application; if you can't test
it objectively, then you have no way of knowing whether any other package is
adequate either (and neither does anyone else, so don't ask).

Ivan Frohne wrote a very nice package of stronger generators, which should
be available from his Starship page.  But unless you're doing extreme work,
WH should be adequate for a start.  Any serious program relying on random
numbers should be tested with at least two distinct generators, though, and
Ivan's pkg is great for that.

nothing-random-about-generating-random-numbers-ly y'rs  - tim






More information about the Python-list mailing list