[SciPy-dev] New random capability [was: Release of scipy core...]

Robert Kern rkern at ucsd.edu
Wed Sep 28 15:36:33 CDT 2005


Charles R Harris wrote:
> On Wed, 2005-09-28 at 14:30 -0400, Tom Loredo wrote:
> 
>>Robert,
>>
>>Wow, thanks for what sounds like some well thought out improvements
>>in the "random" capability of scipy.  Working on this has been on
>>my todo list, but at lower priority than other things.  I think 
>>it's in more capable hands in any case!
>>
>>>I also think some provision for setting a simple seed, perhaps just a long,
>>>is useful for testing when it is nice to have a repeatable sequences.
>>
>>Actually, I think some users need more than this (I certainly speak
>>at least for myself!).  I think there should be capability to store
>>the full current state, and restore it.
> 
> In the Mersenne Twister this also requires storing an index into the
> current state. The MWC type generators need to store the value of the
> carry as well. Perhaps all that is needed is a way to serialize the
> generator or make a copy.

Ack! I forgot about the index. In a little while, the methods
RandomState.{get,set}_state() will also deal with the index and well as
the state array. And in fact, those methods are really just some
underscores away from making the object itself pickleable ...

Saving to and restoring from a file is a nice capability. I'll try to
work it into the current object. Thanks, Tom!

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Scipy-dev mailing list