Random numbers

Russell Wallace rwallace at esatclear.ie
Tue May 23 17:00:02 EDT 2000

Tim Peters wrote:
> [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.

Got it, thanks.  (The HTML docs only mention the basic random number
functions in the whrandom module, which confused me a bit.)

> > 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>.

I don't, except to know how much I don't know :)

> 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.

I'm not, for this application anyway; it's a game, and player actions
generally throw in enough unpredictability that the random number
generator doesn't have to be all that great.  Basically I mainly wanted
to check that it's not *notoriously bad*, like the common implementation
of C's rand(); from what you say, I'm sure it'll be fine.  Thanks.

"To summarize the summary of the summary: people are a problem."
Russell Wallace
mailto:rwallace at esatclear.ie

More information about the Python-list mailing list