Inheritance diagram for UniformRandom:

This class generates real-valued random numbers uniformly distributed over a given range, [low, high).
Definition at line 264 of file Random.H.
Public Member Functions | |
| UniformRandom (const double low=1.0, const double high=0.0, const unsigned long seed=1UL) | |
Generate samples | |
| double | 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 | |
| double | lowValue () const |
| double | highValue () const |
| double | range () const |
Change parameters of the random variable | |
| void | setLowValue (const double low) |
| void | setHighValue (const double high) |
| void | setValues (const double low, const double high) |
Private Attributes | |
| double | m_low |
| double | m_range |
| UniformRandom | ( | const double | low = 1.0, |
|
| const double | high = 0.0, |
|||
| const unsigned long | seed = 1UL | |||
| ) | [inline] |
Alocates an instance of the class, sets the high and low limits for the numbers to be generated, and sets the random number seed.
| low | Low value for the generated numbers. | |
| high | High value for the generated numbers. | |
| seed | Random number seed. Do not set this to zero. |
UniformRandom gen(low, high);
UniformRandom gen(high);
UniformRandom gen;
| double 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 RealRandom.
Definition at line 288 of file Random.H.
References m_low, m_range, and MTRand::rand().
| double mean | ( | ) | const [inline, virtual] |
Implements RealRandom.
| double variance | ( | ) | const [inline, virtual] |
Implements RealRandom.
Definition at line 294 of file Random.H.
References m_range.
Referenced by stdDev().
| double stdDev | ( | ) | const [inline, virtual] |
Implements RealRandom.
Definition at line 295 of file Random.H.
References variance().
| double lowValue | ( | ) | const [inline] |
| double highValue | ( | ) | const [inline] |
| double range | ( | ) | const [inline] |
| void setLowValue | ( | const double | low | ) | [inline] |
Set the low value of the random variable.
| low | New low value. |
Definition at line 312 of file Random.H.
References m_low.
Referenced by setValues().
| void setHighValue | ( | const double | high | ) | [inline] |
Set the high value of the random variable.
| high | New high value. |
Definition at line 315 of file Random.H.
References m_low, and m_range.
Referenced by setValues().
| void setValues | ( | const double | low, | |
| const double | 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 319 of file Random.H.
References setHighValue(), and setLowValue().
double m_low [private] |
Definition at line 324 of file Random.H.
Referenced by highValue(), lowValue(), mean(), number(), setHighValue(), and setLowValue().
double m_range [private] |
Definition at line 325 of file Random.H.
Referenced by highValue(), mean(), number(), range(), setHighValue(), and variance().
1.5.1