[Ns-developers] Random Variables API changes

Tom Henderson tomh at tomh.org
Thu Jan 22 06:20:11 PST 2009


Mathieu Lacage wrote:
> On Wed, 2009-01-21 at 14:32 -0500, Raj Bhattacharjea wrote:
> 
>>>> I wonder why you don't just forward all the SeedManager::Set/Get method
>>>> calls to the RngStream class rather than keep track of your own global
>>>> see: it would save you from having to keep your own set of static global
>>>> seeds (the same variables are stored in RngStream), you could move
>>>> the ::Initialize code below to RngStream::RngStream and remove the call
>>>> to ::Initialize from all the GetValue methods.
>>> I implemented the necessary bits in RngStream for the above (in attached
>>> patch). The only missing piece is modifying the RandomVariable code
>>> which I could do if you want me to.
>>>
>> Could you provide a patch to do what you propose?
> 
> rng.patch: cleanup coding style in random-variable.cc, update API. I did
> not change the lazy creation of m_generator but, as I mentionned in a
> previous email, I did not find any rationale for this so, my gut feeling
> would be to revert to non-lazy creation of these.
> 
> examples.patch: remove all calls to SetSeed
> 
> get-single-value.patch: update users of GetSingleValue to do something
> slightly more sensible than just creation temporary UniformVariables all
> the time. I did not update OlsrAgentImpl.

Mathieu,
I reviewed your patch and looks good to me, except in class SeedManager

+   /**
+    * \brief Get the seed value
+    * \return seed value
+    */
+   static uint32_t GetSeed ();

I thought you wanted to get rid of this method?  Or else fix the doxygen 
to state what it does if the SetSeed (uint32_t seed[6]) was called earlier.

> 
> What is missing:
> 1) Must update all reference traces now.

I would recommend testing that the trace changes are limited to the 
replacement of GetSingleValue().

> 2) optionally, change the --regression code to set NS_RNG:1:1 before
> running any test (not really needed because it is the default)

I did not see any support for NS_RNG yet

> 3) I did not do any of the extensions we discussed: integration in
> ConfigStore and per-variable seed/run changes
> 

4) Doxygen and CHANGES.html

- Tom



More information about the Ns-developers mailing list