On Feb 14, 2008, at 5:05 AM, David Harvey wrote: > > On Feb 14, 2008, at 1:21 AM, Robert Bradshaw wrote: > >>> I'm still willing to work on the "randgen" class I described toward >>> the end of this thread: >>> http://groups.google.com/group/sage-devel/browse_thread/thread/ >>> c2d86a2685018112/4b3136c4a784015a?#4b3136c4a784015a >>> >>> Basically I'm just waiting for somebody to say "Yes, that looks >>> like a >>> good design" before I start. >> >> I would really like to see a sane, centralized pseudo-random number >> framework. Requiring every function that uses (perhaps implicitly) >> random numbers to pass around optional randgen objects will, in my >> opinion, be both inefficient and cumbersome to program with. Rather, >> I think the best option is to have a global randgen object that holds >> states for the various frameworks we use (e.g. gmp, ntl, etc.) where >> algorithms can access it directly. Swapping out this generator for a >> new one should be handled via python contexts. > > Hmmm..... I like this idea in principle, but can it really be made > to work? > > How many underlying systems are we talking about here?
I really don't thing there'll be too many, and we can always add them incrementally. > Also, what about the following issue. I just looked at the NTL > random number framework. There doesn't seem to be any (supported) > interface for getting/setting state. The best you can do is: > > void SetSeed(const ZZ& s); > > s itself is hashed before being used. So without going into > internals, I don't see how you can restore a previous state. (well > I suppose you could just call SetSeed again and count the number of > previous calls you made to Random().... :-)) It's open source, so maybe we'll just have to reach in and do it manually. Even if we don't, the most important feature will be to be able to set a seed and have predictable, reproducible behavior from then on. - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---