[Ns-developers] Random Variables API changes

Tom Henderson tomh at tomh.org
Sun Jan 18 22:34:27 PST 2009

> 4) From an implementation perspective, I think that you are missing the
> NS_RNG env variable handling and the various --Rng* command line options
> I suggested in:
> http://mailman.isi.edu/pipermail/ns-developers/2008-November/004907.html

I agree-- I would like to see that this this is integrated well into our 
existing framework for command line arguments and attributes and that we 
are not giving guidance to users such as the below:
  int N = atol(argv[1]); //read in run number from command line

In particular, it would be preferable if the end result of the 
implementation change were that the seed and run numbers automatically 
end up in the ConfigStore output for any given execution.

Similarly, in all of the example files, I think we should be careful to 
update our suggested usage pattern; e.g.:

-  RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
+  uint32_t seed[6] = {1, 1, 2, 3, 5, 8};
+  SeedManager::SetSeed(seed);

is going to reinforce the less-preferred behavior of changing seeds each 
time to try to get independent runs.  Better would be something like:

-  RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
+  // Change either the run number below or the RngXXX attribute to 
obtain an independent replication
+  SeedManager::SetRun (1);


More information about the Ns-developers mailing list