[Ns-developers] Random Variables API changes

Gustavo Carneiro gjcarneiro at gmail.com
Tue Jan 20 09:19:48 PST 2009

2009/1/20 Raj Bhattacharjea <raj.b at gatech.edu>

> On Tue, Jan 20, 2009 at 11:40 AM, Raj Bhattacharjea <raj.b at gatech.edu>
> wrote:
> > quick ideas that need to be looked at.  The biggest of these is a
> > change like the following:
> >
> > - UniformVariable::GetSingleValue (0, N)
> > + UniformVariable().GetValue (0, N)
> >
> > I had to do this in one place to make things compile, but seems a bit
> I forgot I had to do this in several places, or things similar to
> this.  The affected files are:
> src/devices/csma/backoff.cc
> src/mobility/random-direction-2d-mobility-model.cc
> src/routing/olsr/olsr-agent-impl.cc
> I'm sure the maintainers of these would have their preferred
> implementation.

I wonder what is the rationale for the removal of GetSingleValue?  It seems
to me that keeping a single static UniformVariable global variable is just a
pointless API change, as it is surely equivalent to previous code, while
keeping one UniformVariable per OLSR instance sounds like a memory waste if
no reason for the change is known.

I think there is probably a good reason for the API change and, not that I
don't trust you, but I would like to know what that reason is.  Was the
previous GetSingleValue usage pattern incorrect?

Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert

More information about the Ns-developers mailing list