[Ns-developers] Random Variables API changes

Michele Weigle mweigle at csnet.cs.odu.edu
Fri Oct 31 19:42:03 PDT 2008


On Oct 31, 2008, at 4:51 PM, Raj Bhattacharjea wrote:
> On Wed, Oct 22, 2008 at 3:45 PM, Raj Bhattacharjea  
> <raj.b at gatech.edu> wrote:
>> Including ns-developers in the reply list for this off-list mail...
>>
>> On Thu, Oct 16, 2008 at 12:52 PM, Hadi Arbabi  
>> <hadiarbabi at gmail.com> wrote:
>>> Dear Raj,
>>>
>>> I have attached codes for ns3 random variable with changes done.
>>>
>>
>> I will post a repo with Hadi's changes for review.
>
> I have posted this repo (sorry for the delay Craig).
>
> http://code.nsnam.org/raj/ns-3-rng-changes/
>
> Please see the tip changeset:
> http://code.nsnam.org/raj/ns-3-rng-changes/rev/c9fee5b56a96
>
> Michelle's student Hadi prepared this, I simply posted it for him
> (with some minor changes to end of line encoding and removing some
> unneeded "ns3::" scope).
>
> As far as I can tell, it currently doesn't compile, but I figure that
> getting the jist of the patch out to developers for review was
> important before merge week began.  I will summarize the list of
> changes that I can see in the patchset:
>
> 1.  RandomVariableBase::UseDevRandom and associated functionality has
> been removed.
> 2.  RandomVariableBase has new APIs for getting the seed and run  
> number.
> 3.  Functionality of time-based seeding has been removed.
> 4.  All RandomVariable classes have removed the GetSIngleValue API
> 5.  UniformVariable has a new API which is like GetSingleValue

This new function for UniformVariable is slightly different than  
GetSingleValue.  It is not a static function, so it uses the same RNG  
stream as the instantiated UniformVariable object (this was one of the  
main issues with GetSingleValue).  This function takes min and max  
parameters, so that a user can generate a number from a uniform  
distribution with different min/max than the default min and max  
parameters for the instantiated UniformVariable object.

This seemed to us to be the best way to offer the functionality that  
Mathieu had requested while maintaining the independence of the RNG  
streams.

I believe that if desired, we could add similar functions to the other  
RandomVariable classes, but it wasn't clear that it was needed for  
anything other than UniformVariable.

> 6.  The Box-Muller transform algorithm for NormalVariable generation
> is modified (?)
>
> It would be useful if Hadi and/or Michelle could comment on these on
> the list.  My one concern with the changes lies in the fact that the
> UniformVariable retains a "GetSingleValue" type of API, while no other
> class does.
>
>
> --
> Raj Bhattacharjea
> Georgia Institute of Technology
> School of Electrical and Computer Engineering
> Ph.D. Candidate
> Systems Analyst
> 404.894.2955



More information about the Ns-developers mailing list