[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Random number generators
From: |
Manor Askenazi |
Subject: |
Re: Random number generators |
Date: |
Wed, 17 Jul 96 01:06:47 MDT |
a) I note that Heatbug makes a call to [uniformRandom <parameters>]. I'd
guess uniformRandom is an object of type Uniform - but where is it
defined?
>From ..wherever../swarm/simtools/global.h:
extern Uniform * uniformRandom;
b) Would it not be better if random number generators were NOT
automatically provided? Having to explicitly create them, and provide the
starting seeds, would make it more obvious that there are issues here
that the programmer needs to consider.
Certainly, for purposes of model replication, the value of starting seeds
needs to be stated explicitly -- allowing Swarm to use its ("randomly"
chosen) default seed won't do!
Of course it won't!!!
>From http://www.santafe.edu/projects/swarm/release/swarmdocs/src/random.html:
Each random bit generator can be initialized in one of two ways
-initSeed: (unsigned) seed;
Seed with a particular number
-init;
Use a default seed defined in RandomBitGenerator.h
(getpid() * time(0) at the moment.)
In other words, you _can_ set the seed on the RNGs in Swarm. See my remarks
below about how Brandon (address@hidden) deals with these issues...
Also, it is probably not a good idea to use a single random number stream
to feed all 'users' of random numbers in a given application.
Conceptually independent events ought to be fed by different random
number streams, no?
We give one by default but you can generate as many as necessary...
---------------------------------------------------------------------------
There is one more swarm beta user (address@hidden) which I know of, that
has had to deal with these exact issues (knowing what the seed is etc. etc.).
Apparently he has dealt with all of these problems within the existing
framework provided by <random.h>.
---------------------------------------------------------------------------
c) Has anyone written the code to provide generators other than Uniform?
You mean as in Gaussians, Binomials, Exponentials etc. etc.? No. But most
of these can be generated in a very straightforward manner using the Uniform
distribution. This is one of those components that really ought to be
contributed back by the users which develop them... (hint) :-)
Regards,
Manor.