Re: Random Number Generator Error

2006-03-18 Thread Fredrik Lundh
"ahmet nurlu" wrote: > It gives error: > Traceback (most recent call last): >File "random.py", line 2, in ? > from pylab import * >File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ? > from matplotlib.pylab import * >File "/usr/lib/python2.4/site-packages/mat

Re: random number generator thread safety

2005-11-08 Thread Mike Brown
Raymond Hettinger wrote: > Mike Brown wrote: > > I have questions about thread safety in the 'random' module. > > > > When using the random.Random class (be it Mersenne Twister or Wichmann-Hill > > based), is it sufficiently thread-safe (preserving entropy and guarding > > against attack) to just h

Re: random number generator thread safety

2005-11-08 Thread Raymond Hettinger
> > Thread-safety has nothing to do with preserving entropy or guarding > > against attack. All of the entropy in an MT sequence is contained in > > the seed (upto 624 bytes) and that entropy is preserved through all > > subsequent calls. > > I think the concern is that there can be a thread switc

Re: random number generator thread safety

2005-11-08 Thread Paul Rubin
"Raymond Hettinger" <[EMAIL PROTECTED]> writes: > Thread-safety has nothing to do with preserving entropy or guarding > against attack. All of the entropy in an MT sequence is contained in > the seed (upto 624 bytes) and that entropy is preserved through all > subsequent calls. I think the concer

Re: random number generator thread safety

2005-11-08 Thread Raymond Hettinger
Mike Brown wrote: > I have questions about thread safety in the 'random' module. > > When using the random.Random class (be it Mersenne Twister or Wichmann-Hill > based), is it sufficiently thread-safe (preserving entropy and guarding > against attack) to just have each thread work with its own ran

Re: random number generator

2005-11-04 Thread Bryan Olson
Fredrik Lundh wrote: >>How to generate a random number in Python. Is there any build in >>function I can call? > > > >>> import random > >>> help(random) If you need crypto-quality randomness: >>> import os >>> help(os.urandom) -- --Bryan -- http://mail.python.org/mailman/listinfo

Re: random number generator

2005-11-03 Thread avnit
import random print random.randint(1,20) #prints random integer from 1 to 20 -- http://mail.python.org/mailman/listinfo/python-list

Re: random number generator

2005-11-03 Thread Fredrik Lundh
> How to generate a random number in Python. Is there any build in > function I can call? >>> import random >>> help(random) also see: http://docs.python.org/lib/module-random.html -- http://mail.python.org/mailman/listinfo/python-list