![]() |
appkit
1.5.1
RoadNarrows Robotics Application Kit
|
Random variable generators class. More...
#include <Random.h>
Public Member Functions | |
| Random (ulong_t luSeed=AUTO_SEED) | |
| Default initialization constructor. More... | |
| virtual | ~Random () |
| Destructor. | |
| int | randint () |
| Generates a random integer uniformally distrubuted between [-2^31, 2^32-1]. More... | |
| int | randrange (int nMin=0, int nMax=INT_MAX) |
| Generates a random integer uniformally distrubuted between [nMin, nMax]. More... | |
| s64_t | randrange (s64_t nMin=0, s64_t nMax=LLONG_MAX) |
| Generates a random 64-bit integer uniformally distrubuted between [nMin, nMax]. More... | |
| float | uniform (float fMin=0.0, float fMax=1.0) |
| Generates a random float uniformally distrubuted between [fMin, fMax]. More... | |
Static Public Attributes | |
| static const ulong_t | AUTO_SEED = 0 |
Protected Attributes | |
| struct drand48_data | m_randState |
| random generator opaque state. | |
| Random::Random | ( | ulong_t | luSeed = AUTO_SEED | ) |
Default initialization constructor.
| luSeed | Random generator seed. |
Definition at line 72 of file Random.cxx.
References m_randState.
|
inline |
Generates a random integer uniformally distrubuted between [-2^31, 2^32-1].
Definition at line 102 of file Random.h.
References m_randState, randrange(), and uniform().
| int Random::randrange | ( | int | nMin = 0, |
| int | nMax = INT_MAX |
||
| ) |
Generates a random integer uniformally distrubuted between [nMin, nMax].
| nMin | Minimum value. |
| nMax | Maximum value. |
Definition at line 88 of file Random.cxx.
References m_randState.
Referenced by randint(), and rnr::State::receiveEvent().
| s64_t Random::randrange | ( | s64_t | nMin = 0, |
| s64_t | nMax = LLONG_MAX |
||
| ) |
Generates a random 64-bit integer uniformally distrubuted between [nMin, nMax].
| nMin | Minimum value. |
| nMax | Maximum value. |
Definition at line 97 of file Random.cxx.
References m_randState.
| float Random::uniform | ( | float | fMin = 0.0, |
| float | fMax = 1.0 |
||
| ) |
Generates a random float uniformally distrubuted between [fMin, fMax].
| fMin | Minimum value. |
| fMax | Maximum value. |
Definition at line 106 of file Random.cxx.
References m_randState.
Referenced by UTThread::exec(), and randint().