Random numbers

emile at fenx.com emile at fenx.com
Mon May 22 06:27:54 EDT 2000


Russell,

If I'm not mistaken, whrandom is imported by random, and importing
random would be the normal way of accessing it.

Repeatable sequences can be generated by reseeding with the same value:

>>> import random
>>> random.seed("Spam")
>>> print random.random()
0.188524911272
>>> print random.random()
0.795451892756
>>> print random.random()
0.191986312458
>>> random.seed("Spam")
>>> print random.random()
0.188524911272
>>> print random.random()
0.795451892756
>>> print random.random()
0.191986312458

HTH,

Emile van Sebille
emile at fenx.com

Russell Wallace <rwallace at esatclear.ie> wrote in message
news:<3929068F.622C at esatclear.ie>...
> Oops sorry, pressed the wrong button.  Trying again:
> 
> Is there any difference between the random number generator in the'
> random' module and that in the 'whrandom' one?
> 
> What's the quality of the numbers generated?  I don't need the absolute
> best, but hopefully it's at least better than a linear congruential
> generator?
> 
> Is there a way to get a reproducible sequence of random numbers? 
> seed(0,0,0) doesn't seem to have any effect.
> 
> Thanks,
> 
> -- 
> "To summarize the summary of the summary: people are a problem."
> Russell Wallace
> mailto:rwallace at esatclear.ie
> http://www.esatclear.ie/~rwallace
> -- 
> http://www.python.org/mailman/listinfo/python-list
>




More information about the Python-list mailing list