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>
Public Member Functions | |
UniformVariable () | |
UniformVariable (double s, double l) | |
uint32_t | GetInteger (uint32_t s, uint32_t l) |
Returns a random unsigned integer from the interval [s,l] including both ends. | |
double | GetValue (void) const |
call RandomVariable::GetValue | |
double | GetValue (double s, double l) |
Returns a random double with the specified range. | |
![]() | |
RandomVariable () | |
RandomVariable (const RandomVariable &o) | |
~RandomVariable () | |
uint32_t | GetInteger (void) const |
Returns a random integer integer from the underlying distribution. | |
RandomVariable & | operator= (const RandomVariable &o) |
Additional Inherited Members | |
![]() | |
RandomVariable (const RandomVariableBase &variable) | |
RandomVariableBase * | Peek (void) const |
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.
Definition at line 103 of file random-variable.h.
ns3::UniformVariable::UniformVariable | ( | ) |
Creates a uniform random number generator in the range [0.0 .. 1.0).
Definition at line 243 of file random-variable.cc.
ns3::UniformVariable::UniformVariable | ( | double | s, |
double | l | ||
) |
Creates a uniform random number generator with the specified range
s | Low end of the range |
l | High end of the range |
Definition at line 247 of file random-variable.cc.
uint32_t ns3::UniformVariable::GetInteger | ( | uint32_t | s, |
uint32_t | l | ||
) |
Returns a random unsigned integer from the interval [s,l] including both ends.
s | Low end of the range |
l | High end of the range |
Definition at line 262 of file random-variable.cc.
References GetValue(), and NS_ASSERT.
double ns3::UniformVariable::GetValue | ( | void | ) | const |
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.
Definition at line 252 of file random-variable.cc.
Referenced by RngUniformTestCase::ChiSquaredTest(), GetInteger(), and main().
double ns3::UniformVariable::GetValue | ( | double | s, |
double | l | ||
) |
Returns a random double with the specified range.
s | Low end of the range |
l | High end of the range |
Definition at line 257 of file random-variable.cc.
References ns3::RandomVariable::Peek().