[Python-Dev] Unittests

Tim Peters tim.one@comcast.net
Wed, 10 Apr 2002 18:05:46 -0400

> There's nothing bad in the .seed() method. You just have to pass it
> some sane values (rather than relying on the defaults).

I disagree on both counts.  The defaults were fine, but the underlying seed
method had severe limitations, as the docs for Random.whseed() explain.
Being able to initialize to only one of ~2**24 distinct states means
Birthday Paradox surprises only needed O(2**12) expected tries to surface,
no matter how good the seed selection was.

The newer seed() method allows getting at every one of the possible (for
this generator) ~2**45 internal states, and makes distinctness guarantees
that are easy to understand and to exploit.  The older seed method is
preserved for bit-for-bit identical results in Random.whseed(), for those
who really need it, but no newcomer who knows what they're doing would want
to use it.  Since most newcomers don't know what they're doing, it's
important that the default method save them from the consequences of failing
to make an informed analysis of the older seed algorithm.