ns3::UniformVariable Class Reference
[Random Variable Distributions]

The uniform distribution RNG for NS-3.

This class supports the creation of objects that return random numbers from a fixed uniform distribution. It also supports the generation of single random numbers from various uniform distributions. More...

#include <random-variable.h>

Inheritance diagram for ns3::UniformVariable:

Inheritance graph
[legend]
Collaboration diagram for ns3::UniformVariable:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 UniformVariable ()
 UniformVariable (double s, double l)
double GetValue (void) const
 call RandomVariable::GetValue
double GetValue (double s, double l)
 Returns a random double with the specified range.
uint32_t GetInteger (uint32_t s, uint32_t l)
 Returns a random unsigned integer from the interval [s,l] including both ends.


Detailed Description

The uniform distribution RNG for NS-3.

This class supports the creation of objects that return random numbers from a fixed uniform distribution. It also supports the generation of single random numbers from various uniform distributions.

The low end of the range is always included and the high end of the range is always excluded.

 UniformVariable x(0,10);
 x.GetValue();  //will always return numbers [0,10)
 UniformVariable::GetSingleValue(100,1000); //returns a value [100,1000)

Constructor & Destructor Documentation

ns3::UniformVariable::UniformVariable (  ) 

Creates a uniform random number generator in the range [0.0 .. 1.0).

ns3::UniformVariable::UniformVariable ( double  s,
double  l 
)

Creates a uniform random number generator with the specified range

Parameters:
s Low end of the range
l High end of the range


Member Function Documentation

uint32_t ns3::UniformVariable::GetInteger ( uint32_t  s,
uint32_t  l 
)

Returns a random unsigned integer from the interval [s,l] including both ends.

Parameters:
s Low end of the range
l High end of the range
Returns:
A random unsigned integer value.

double ns3::UniformVariable::GetValue ( double  s,
double  l 
)

Returns a random double with the specified range.

Parameters:
s Low end of the range
l High end of the range
Returns:
A floating point random value

double ns3::UniformVariable::GetValue ( void   )  const

call RandomVariable::GetValue

Returns:
A floating point random value
Note: we have to re-implement this method here because the method is overloaded below for the two-argument variant and the c++ name resolution rules don't work well with overloads split between parent and child classes.

Reimplemented from ns3::RandomVariable.


The documentation for this class was generated from the following file:

Generated on Fri Apr 9 15:01:09 2010 for NS-3 by  doxygen 1.5.8