On Tuesday 23 July 2002 20:54, Todd Miller wrote:
Eric Maryniak wrote:
That should not, however, discourage you from writing a new and improved random number package for numarray.
Yes, thank you :-)
... 3. I wonder what the design philosophy is behind the decision to use 'mathematically suspect' seeding as default behavior.
Using time for a seed is fairly common. Since it's an implementation detail, I doubt anyone would object if you can suggest a better default seed.
Well, as said, a fixed seed, provided by the class implementation and therefore 'good', instead of a not-so-random 'random' seed. And imho it would be better not to (only) use the clock, but a /dev/random kinda thing. Personally, I find the RNG setup much more appealing: there the default is:
standard_generator = CreateGenerator(-1)
seed < 0 ==> Use the default initial seed value. seed = 0 ==> Set a "random" value for the seed from the system clock. seed > 0 ==> Set seed directly (32 bits only).
And indeed 'void Mixranf(int *s,u32 s48)' uses a built-in constant as initial seed value (actually, two).
If you use default seed()'ing now and re-run your program/model later with identical parameters, you will get different output.
When you care about this, you need to set the seed to something deterministic.
Naturally, but how do I know what a 'good' seed is (or indeed it's type, range, etc.)? I just would like, as e.g. RNG does, let the number generator take care of this... (or at least provide the option to)
In the programs I've seen so far, including a lot of ours ahem, usually a program (simulation) is run multiple times with the same parameters and, in our case for neural nets, seeded each time with a clock generated seed and then the different simulations are compared and checked if they are similar or sensitive to chaotic influences. But I don't think this is the proper way to do this. My point is, I guess, that the sequence of these clock-generated seeds itself is not random, because (as for RandomArray) the generated numbers are clearly not random. Better, and reproducible, would be to start the first simulation with a supplied seed, get the seed and pickle after the first run and use the pickled seed for run 2 etc. or indeed have a kind of master script (as you suggest) that manages this. That way you would start with one seed only and are not re-seeding for each run. Because if the clock-seeds are not truly random, you will a much greater change of cycles in your overall sequence of numbers.