[Ns-developers] ns-3.4 : Random Variables

raj bhattacharjea rbhattacharjea at gmail.com
Wed Feb 25 11:18:22 PST 2009


On Wed, Feb 25, 2009 at 2:15 PM, Timo Bingmann
<timo.bingmann at student.kit.edu> wrote:
> Hello,
>
> I'm somewhat confused on how to use/change the new RandomVariables:
> This was previously the core part of the Nakagami propagation loss model:
>
> resultPowerW = GammaVariable::GetSingleValue(m, powerW / m);
>
> GammaVariable is an extension by me, but ExponentialVariable and others work likewise, this is only about the class interface. Obviously powerW changes for each call. So I cannot make a
> GammaVariable m_rndvar(m, ...);
> and pull a value each time.
>
> Only way that works with the current API of just one GetValue() would be
>
> resultPowerW = GammaVariable(m, powerW / m).GetValue();
>
> however that creates a new RngStream() inside for each GammaVariable created. Also not what I want for propagation loss modelling.
>
> So what do I do? I created a second GammaVariable::GetValue(alpha, beta) similar to the UniformVariable::GetValue(min,max). However the GetValue(a,b) code doesn't feel good, because I use the class-internal m_rngStream but ignore class-internal variables m_alpha, m_beta; so why have them in the first place?
>
> Shouldn't this be done for all other RandomVariables as well? None other than Uniform has this.

Ugh.  I thought this was done for all the other classes other than
Uniform.  That was the intention, and I remember patching that
functionality in....I wonder if it wasn't lost of the merging process
somewhere along the way.

I'll push a fix soon.

-- 
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