Unit tests and random.Random()

Danil danil at ultranet.com
Thu Jan 10 22:15:15 EST 2002


I've got unit tests (oh, that's a good thing, right?) that, alas, are 
implemented using whrandom to get their own instances of Wichmann-Hill 
generators.

Of course, I've noticed that whrandom is deprecated.  "Use random 
instead".  Fine.

Except that, reading the documentation (5.6 random - Generate pseudo-
random numbers), it doesn't appear that random.Random is promising me a 
W-H generator, but instead just some unspecified instance of the class 
used under the covers by random (which, by fortuitous coincidence, 
happens to be a WH implementation, today, but it could change in the 
future).

Is there an official position on how code should be written to guarantee 
that it gets a WH generator[1]?  And where should I have looked to find 
this answer for myself?

Danil





More information about the Python-list mailing list