[Ns-developers] [ns-3] proposed RNG changes
Michele Weigle
mweigle at csnet.cs.odu.edu
Mon Sep 8 10:54:26 PDT 2008
Hi all,
After discussions with Tom and Mathieu, here are some proposed changes
to the way the RNG and RandomVariable classes work in ns-3. Please
feel free to comment.
* no time-based seed initialization
We decided to remove the default behavior of setting the global RNG
seed by timeofday. Instead, the default will be to have the seed set
to some constant value. This will result in ns-3 producing the same
results each time it is run, unless the user changes the global seed
or changes the run number.
The reason for this change is to enforce good simulation practices.
If the global seed is set by timeofday, the user needs to carefully
record the exact seed used in order to re-run the same experiment.
More importantly, if the user plans on running several experiments to
obtain statistics like an average with confidence intervals, using
timeofday to set the seed does not guarantee that the multiple runs
will be independent.
The L'Ecuyer RNG default in ns-3 provides a very easy way to ensure
that multiple runs are guaranteed to be independent. This is by
setting a global seed once and changing only the run number for each
replication of the experiment. The resulting numbers are guaranteed
to be random and independent.
In addition, with the L'Ecuyer RNG, there is no notion of 'bad' seeds
or 'good' seeds. Any number used as a seed is valid. The range of
possible seeds is 1 to MAXINT.
The RNG also provides a large stream of random numbers so that for
each experiment, up to 2^51 (or, 2.3 x 10^15) independent replications
are possible. This means that the maximum run number allowed is 2^51
(or less, depending on the datatype used to store the run number).
* change the interface of setting the RNG seed to 1 value instead of 6
values
This is just a simplification of the interface. The actual seed in
the L'Ecuyer RNG is a 6-tuple, which will be set all to the same value
provided by the user.
* remove the GetSingleValue function from RandomVariable classes
The GetSingleValue function allows for potential non-independence as
it draws values from a single RNG stream for different random
variables. Each random variable should have its own RNG stream.
* provide Stream API
We will provide a Stream API to allow the user to set the seed and run
number of the global RNG. This Stream API will also allow access to
the first RNG stream (not associated with any random variable) and
allow the user to draw numbers from a uniform distribution with min
and max as parameters.
Ex: double PickUniform (double min, double max);
This is different from the random variable Uniform because once the
RandomVariable object is created, min and max cannot be changed.
-Michele
--
Michele Weigle
Assistant Professor
Department of Computer Science
Old Dominion University
Norfolk, VA 23539
mweigle at cs.odu.edu
http://www.cs.odu.edu/~mweigle
(757) 683-6001 ext. 5050
More information about the Ns-developers
mailing list