[Ns-developers] ns-3.4 : Random Variables
Mathieu Lacage
mathieu.lacage at sophia.inria.fr
Sat Feb 21 11:39:30 PST 2009
On Fri, 2009-02-20 at 17:45 -0500, Raj Bhattacharjea wrote:
> To move forward, let's remove the SetSeed method in question. The
> functionality it provides will still be exported via the attributes
> system and the command line. I have an implementation in mind, where
> the GlobalValue g_rngSeed will initialize from either the command
> line, or default to a value. This will require shuffling around
> Mathieu's code a bit.
The following is probably what you have in mind but, in case you don't,
it should be fairly trivial to:
- make SeedManager::SetSeed call g_rngSeed.Set ()
- make GlobalValue::GlobalValue call GetInitialSeedValue shown below:
static AttributeValue GetInitialSeedValue (void)
{
// lookup env var first.
// if set, return env var value.
// if unset, return default value, that is, '1'.
}
The above won't allow you to set the seed by the full 6-double array. If
you wanted to support this, you would have to create a new kind of
object which can hold a full seed, and, then, give to this object
'attribute' powers, just like IntegerValue. I don't think that this is
worth the effort but this should work.
> This brings up the more general question of how to put environment
> variables into the mix of attributes/GlobalValues; currently we can
> override Attribute defaults using Config::SetDefault, or by passing
> --ns3::AttributeName=value on the command line; perhaps in the future
> we should come up with a general way to specify how these values
> should hook into a environment variables automatically, since this
> kind of behavior might be desired. More on this later.
Yes, it should be possible to add something in the GlobalValue and the
attribute code to initialize from NS_DEFAULT_VALUE and NS_GLOBAL_VALUE:
for example, using '=' to separate names from values and ':' values from
other names:
NS_DEFAULT_VALUE=ns3::Ipv4L3Protocol::Checksum=true:ns3::TcpL4Protocol::Checksum=true
Feel free to file a bug to keep track of this issue.
regards,
Mathieu
More information about the Ns-developers
mailing list