Inheritance diagram for DiscreteUniformRandom:
This class generates discrete random numbers from a uniform distribution.
Definition at line 454 of file Random.H.
Public Member Functions | |
DiscreteUniformRandom (const int low, const int high, const unsigned long seed=1UL) | |
DiscreteUniformRandom (const int range, const unsigned long seed=1UL) | |
Generate samples | |
int | number () |
Generate a sample from the random variable. | |
Moments of the random variable | |
double | mean () const |
double | variance () const |
double | stdDev () const |
Parameters of the random variable | |
int | lowValue () const |
int | highValue () const |
int | range () const |
Change parameters of the random variable | |
void | setLowValue (const int low) |
void | setHighValue (const int high) |
void | setValues (const int low, const int high) |
Private Attributes | |
int | m_low |
unsigned long | m_range |
DiscreteUniformRandom | ( | const int | low, | |
const int | high, | |||
const unsigned long | seed = 1UL | |||
) | [inline] |
This constructor sets the low and high values for the distribution, and the random number seed.
low | Low value for generated numbers. | |
high | High value for generated numbers. | |
seed | Random number seed. Do not set this to zero. |
DiscreteUniformRandom | ( | const int | range, | |
const unsigned long | seed = 1UL | |||
) | [inline] |
This constructor sets the high value for the distribution, and the random number seed. The low value is assumed to be 0.
range | Range of discrete numbers to be generated. | |
seed | Random number seed. Do not set this to zero. |
int number | ( | ) | [inline, virtual] |
Generate a sample from the random variable.
This function generates a sample from the random variable represented by the class instance.
Implements IntegerRandom.
Definition at line 480 of file Random.H.
References m_low, m_range, and MTRand::randInt().
double mean | ( | ) | const [inline, virtual] |
Implements IntegerRandom.
Definition at line 485 of file Random.H.
References m_range.
double variance | ( | ) | const [inline, virtual] |
Implements IntegerRandom.
Definition at line 486 of file Random.H.
References m_range.
Referenced by stdDev().
double stdDev | ( | ) | const [inline, virtual] |
Implements IntegerRandom.
Definition at line 487 of file Random.H.
References variance().
int lowValue | ( | ) | const [inline] |
int highValue | ( | ) | const [inline] |
int range | ( | ) | const [inline] |
void setLowValue | ( | const int | low | ) | [inline] |
Set the low value for the random variable.
low | The new low value. |
Definition at line 504 of file Random.H.
References m_low.
Referenced by setValues().
void setHighValue | ( | const int | high | ) | [inline] |
Set the high value for the random variable.
high | The new high value. |
Definition at line 507 of file Random.H.
References m_low, and m_range.
Referenced by setValues().
void setValues | ( | const int | low, | |
const int | high | |||
) | [inline] |
Set the both the low and high values of the random variable.
low | Low high value. | |
high | New high value. |
Definition at line 511 of file Random.H.
References setHighValue(), and setLowValue().
int m_low [private] |
Definition at line 516 of file Random.H.
Referenced by highValue(), lowValue(), number(), setHighValue(), and setLowValue().
unsigned long m_range [private] |
Definition at line 517 of file Random.H.
Referenced by highValue(), mean(), number(), range(), setHighValue(), and variance().