Bugzilla – Bug 101
random variable intialization
Last modified: 2009-03-13 10:39:31 EDT
You need to log in before you can comment on or make changes to this bug.
utils/run-tests.cc now has a call to ns3::RandomVariable::UseGlobalSeed to ensure that the tests use a fixed global seed for all RandomVariable instances. This reduces the efficiency of the Buffer tests in src/common/buffer.cc which expect to get a new seed at every run. We need a way to force a specific seed locally in RandomVariableTest::RunTests Here is an exerpt from email exchanges about this issue: ------------------- Mathieu ------------------------ So, these are 2 use-cases where you need to be able to force a specific seed for a specific instance of a pseudo random number generator stream, which cannot be achieved with the current API. I think that it would have made sense to separate these two features: - the ability to create a random stream with a specific initial seed - the ability to generate a stream of initial seeds for a set of random streams i.e., class RandomSeedGenerator { public: // create a new seed generator RandomSeedGenerator (); // return a new seed. Seed GetSeed (void); // return the default random seed generator, the one which should be used all the time. static RandomSeedGenerator *GetDefault (void); }; class RandomVariable { // force a specific seed generator to see this stream RandomVariable (RandomSeedGenerator *); // use the default seed generator RandomVariable (); }; A simpler alternative which would save you from having to add a set of new extra constructors to each RandomVariable subclass would be to use a stack of seed generators and call RandomSeedGenerator::Front from RandomVariable's constructor. class RandomSeedGenerator { static RandomSeedGenerator *Front (void); static void Push (RandomSeedGenerator *); static void Pop (void); }; ----------------------- Raj -------------------------- This choice of API was based on Michelle Weigle's advice: http://mailman.isi.edu/pipermail/ns-developers/2007-March/002922.html Note that we had the functionality you wanted in "SetSeed"sometime in February or March, but I deferred to her judgment and her invocation of the rng-stream's creator's opinion on the matter. That said, I believe bringing back the per RandomVariable SetSeed method should satisfy this requirement? This would be a simpler solution than the RandomSeedGenerator you mentioned, since this would complicate the API and the understanding of how our RNGs work. Right now we have one "line" of seeds used by the entire system, generated by the RngStream class...you are suggesting that different RandomVariable could be seeded from different "lines". Is this correct?
adding raj to CC list.
Closed by RNG API changes merged for ns-3.4