Re: [Python-Dev] random number generator state

2009-08-16 Thread Scott David Daniels
Raymond Hettinger wrote: [Scott David Daniels] I find I have a need in randomized testing for a shorter version of getstate, even if it _is_ slower to restore. [blah about big state] Sounds like you could easily wrap the generator to get this. It would slow you down but would give the

Re: [Python-Dev] random number generator state

2009-08-16 Thread Greg Ewing
Scott David Daniels wrote: No, I don't really need MT. The others would be fine. I'd love further details. The one I've been working with is due to Pierre L'Ecuyer [1] and is known as MRG32k3a. It's a combined multiple recursive linear congruential generator with 6 words of state. The

Re: [Python-Dev] random number generator state

2009-08-15 Thread Raymond Hettinger
[Scott David Daniels] I find I have a need in randomized testing for a shorter version of getstate, even if it _is_ slower to restore. When running exhaustive tests, a failure report should show the start state of the generator. Unfortunately, our current state includes a 625-element array.

Re: [Python-Dev] random number generator state

2009-08-15 Thread Mark Dickinson
On Sat, Aug 15, 2009 at 8:54 PM, Scott David Danielsscott.dani...@acm.org wrote: [...] input to .setstate: old, new-short, and new-long.  In trying to get this to work, I found what might be a bug: code says  mt[0] = 0x8000UL; /* MSB is 1; assuring non-zero initial array */ but probably

Re: [Python-Dev] random number generator state

2009-08-15 Thread Greg Ewing
Scott David Daniels wrote: I find I have a need in randomized testing for a shorter version of getstate, even if it _is_ slower to restore. When running exhaustive tests, a failure report should show the start state of the generator. Unfortunately, our current state includes a 625-element