[Ns-developers] ns3: random numbers

Michele Weigle mweigle at cs.odu.edu
Mon Mar 12 10:58:54 PDT 2007


On Mar 12, 2007, at 12:49 PM, mathieu lacage wrote:
> On Mon, 2007-03-12 at 12:30 -0400, Michele Weigle wrote:
>> To generate multiple independent replications of a simulation (for
>> example, for computing the mean and confidence interval of some
>> metric), you should set the runNumber global variable along with the
>> global seed.  The global seed should be the same for all runs of the
>> simulation, and runNumber should be incremented for each run of the
>> simulation.  Behind the scenes, the RNG will seed the RandomVariables
>> such that not only are all RandomVariables within a simulation run
>> independent, but that all RandomVariables over all simulation runs
>> are independent.
>
> The following question is probably naive but I will shoot anyway.  
> Could
> you avoid using a runNumber variable and keep on seeding all new  
> streams
> from the same initial seeding stream during the subsequent runs ? Or
> would this have obviously bad properties from the point of view of
> randomness ?

So, instead of using substreams, just take the last seed used from  
the current run and use it as the global seed for the next run?  I  
don't see any problem with that.  This RNG has 1.8x10^19 independent  
streams, so you shouldn't ever run out.  We'd just have to include a  
function that returns the next seed to be used so that you can save  
it and use it as the global seed in your next run.

FYI -- for a diagram (from L'Ecuyer) of streams vs. substreams, see
http://www.cs.odu.edu/~mweigle/research/netsim/rng/rng.html

-Michele



More information about the Ns-developers mailing list