[Ns-developers] proposed RNG changes

Tom Henderson tomh at tomh.org
Wed Sep 10 22:02:11 PDT 2008


 >>
 >> 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.
 > It is easy enough to print out the timeofday seeds on standard out along
 > with other statistics; I don't see the problem

George,
Although printing the seeds solves the first problem cited above, it
doesn't solve the second problem.

 >>
 >>
 >> 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.
 > I agree completely with this. I expect the "good simulation practice"
 > would be to set a global seed manually, and then change the run number
 > to get the desired independence and randomness.

This is what convinced me that our current default should be changed; if
we want good simulation practice to be ns-3 default behavior, I think
that we (or users) ought to set the seed manually by default and teach
users to set the run numbers.

 >>
 >>
 >> 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.
 > You know much more about this than I do, but there is a subroutine
 > provided by L'Ecuyer called "CheckSeeds".  See the call to it in
 > random-variable.cc.
 > I'm not sure I understand why he would provide such a subroutine if
 > there were indeed no "bad" seeds.
 >>
 >>
 >> 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 fine as long as you don't remove the original one; If I want to
 > specify the full 6 seed values I should be able to do it.  We don' t need
 > to "force users" to our way of thinking how this should be done

In reading the CheckSeeds code, there seem to be a few bad seed
combinations, but these could easily be detected with a single-seed API.
   Specifically, an easy rule that users would need to remember is "seed
  > 0".  Although we could still retain the six-integer API for maximum
flexibility.

- Tom


More information about the Ns-developers mailing list