On Oct 8, 2007, at 9:34 AM, cwitty wrote: > On Oct 8, 7:36 am, "William Stein" <[EMAIL PROTECTED]> wrote: >> I do encourage David to open a trac ticket about this. He's right >> that >> seeding the random number generator should be possible via a command >> line argument at startup. > > But which random number generator? libc, Python, libpari, NTL, > libgmp... not counting the many subprocesses that have their own > random number generator.
I believe gmp, Python, and NTL can be seeded, perhaps others. > I have a rough proposal to try to bring some order to this mess. > Randomness in SAGE should be centered in a "randgen" object. There is > a global default randgen, but others can be created. All algorithms > that use random numbers should take an optional randgen parameter, and > use the numbers from there. The numbers from a randgen would be > portable across architectures. I'm not sure what impact this would have on performance... both in terms of our randgen object's efficiency and in passing this (optional) parameter all over the place (and through anything that may use a randomized subroutine). Random number sources may be one of the things that is OK to have a global for. Not that I'm saying it's a bad idea, but it should be looked at more. There's also the question of specifying distributions, which perhaps should be looked into at the same time, and other issues (e.g. What is a random element of RR[x]) I think one should always be able to generate a random element without any parameters (e.g. so a generic random matrix (not using the term in the theoretical sense) could just fill itself with random entries). > > This would have several advantages. Randomized algorithms could be > run repeatably, for testing or debugging. All of our "random" > doctests could be tested, instead of ignored. Some (many?) of the random doctests are the result of differing inexact floating point calculations. > > I would be willing to work on this, if people think it's a good idea. > What do you think? I think it is a great idea whose time is way overdue. > > Carl > > > --~--~---------~--~----~------------~-------~--~----~ 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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---