whrandom seed question

Preston Landers prestonlanders at my-deja.com
Thu Dec 16 16:35:59 EST 1999


Greetings,

According to Beazley's "Essential Python Reference" (I haven't checked
the 'official' docs) if the three parameters given to whrandom.seed()
are equal, then *the current time* is used as the seed.  Presumably, the
clock is ticking in between your .seed() statements below.

If you want predictable 'random' numbers, then use nonequal parameters
to seed().

---Preston

In article <81eu22$411al$1 at umbc7.umbc.edu>,
  kyriacou at umbc.edu (Stelios Kyriacou) wrote:

> Shouldn't the following 3 lines produce the same number?
>
> >>> whrandom.seed(0,0,0); print whrandom.random()
> 0.39613674715
> >>> whrandom.seed(0,0,0); print whrandom.random()
> 0.170188890936
> >>> whrandom.seed(0,0,0); print whrandom.random()
> 0.831213988577
> >>>

--
|| Preston Landers <prestonlanders at my-deja.com> ||


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list