random number generator thread safety

2005-11-08 Thread Mike Brown
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 random.Random instance? Or

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

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 concern is

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 switch after

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 have each