[Ns-bugs] [Bug 101] New: random variable intialization
bugzilla-daemon@nsnam-www.ece.gatech.edu
bugzilla-daemon at nsnam-www.ece.gatech.edu
Mon Nov 5 00:30:28 PST 2007
http://www.nsnam.org/bugzilla/show_bug.cgi?id=101
Summary: random variable intialization
Product: ns-3
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: simulation core
AssignedTo: ns-bugs at isi.edu
ReportedBy: mathieu.lacage at sophia.inria.fr
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?
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Ns-bugs
mailing list