Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unit tests and random.Random()

0 views
Skip to first unread message

Danil

unread,
Jan 10, 2002, 10:15:15 PM1/10/02
to

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


Tim Peters

unread,
Jan 10, 2002, 11:02:41 PM1/10/02
to
[Danil]]
> ...

> Is there an official position on how code should be written to guarantee
> that it gets a WH generator[1]?

No, not even a guarantee that there always *will* be a way to get a WH
generator. It's mounds better than the C library's rand(), but falls
increasingly behind the reasonable state of the art.

> And where should I have looked to find this answer for myself?

You had already figured that out yourself, so I'd say you looked in the
right places.


0 new messages