Manages a thread which calls a specified function at a specified interval.
More...
|
uint64_t | seed |
| Seed for the random number generator.
|
|
bool | useSeed |
| Flag whether to use the seed instead of the system time.
|
|
|
static std::string | hashSeed (const std::string &seed) |
| Hash the given seed.
|
|
|
std::mt19937_64 | _generator |
| Random number generator.
|
|
Manages a thread which calls a specified function at a specified interval.
Definition at line 28 of file RandomNumberGenerator.hpp.
◆ RandomNumberGenerator() [1/3]
NAV::RandomNumberGenerator::RandomNumberGenerator |
( |
bool | useSeed = true | ) |
|
|
inlineexplicit |
◆ RandomNumberGenerator() [2/3]
◆ RandomNumberGenerator() [3/3]
◆ ~RandomNumberGenerator()
NAV::RandomNumberGenerator::~RandomNumberGenerator |
( |
| ) |
|
|
default |
◆ getRand_normalDist()
template<typename RealType = double>
double NAV::RandomNumberGenerator::getRand_normalDist |
( |
RealType | mean = 0.0, |
|
|
RealType | stddev = 1.0 ) |
|
inline |
Gets a random number from a normal distribution.
- Template Parameters
-
RealType | The result type generated by the generator. The effect is undefined if this is not one of float, double, or long double |
- Parameters
-
mean | The μ distribution parameter (mean) |
stddev | The σ distribution parameter (standard deviation) |
- Returns
- Random number
Definition at line 91 of file RandomNumberGenerator.hpp.
◆ getRand_uniformIntDist()
template<typename IntType = int>
double NAV::RandomNumberGenerator::getRand_uniformIntDist |
( |
IntType | min = 0, |
|
|
IntType | max = std::numeric_limits<IntType>::max() ) |
|
inline |
Gets a random integer number from an uniform distribution.
- Template Parameters
-
IntType | The result type generated by the generator. The effect is undefined if this is not one of short, int, long, long long, unsigned short, unsigned int, unsigned long, or unsigned long long. |
- Parameters
-
min | Minimum value |
max | Maximum value |
- Returns
- Random number
Definition at line 69 of file RandomNumberGenerator.hpp.
◆ getRand_uniformRealDist()
template<typename RealType = double>
double NAV::RandomNumberGenerator::getRand_uniformRealDist |
( |
RealType | min = 0.0, |
|
|
RealType | max = 1.0 ) |
|
inline |
Gets a random real number from an uniform distribution.
- Template Parameters
-
RealType | The result type generated by the generator. The effect is undefined if this is not one of float, double, or long double |
- Parameters
-
min | Minimum value |
max | Maximum value |
- Returns
- Random number
Definition at line 80 of file RandomNumberGenerator.hpp.
◆ hashSeed()
static std::string NAV::RandomNumberGenerator::hashSeed |
( |
const std::string & | seed | ) |
|
|
inlinestaticprivate |
◆ operator=() [1/2]
Copy assignment operator.
◆ operator=() [2/2]
Move assignment operator.
◆ resetSeed()
void NAV::RandomNumberGenerator::resetSeed |
( |
size_t | id = 0 | ) |
|
|
inline |
Reset the seed to the internal seed or the system time.
- Parameters
-
id | Some id used to make a unique hash when using the system time to set the seed |
Definition at line 46 of file RandomNumberGenerator.hpp.
◆ resetSeedOnce()
void NAV::RandomNumberGenerator::resetSeedOnce |
( |
uint64_t | userSeed | ) |
|
|
inline |
Reset the seed to the specified seed, but do not update the internal seed.
- Parameters
-
[in] | userSeed | Seed to use once |
Definition at line 56 of file RandomNumberGenerator.hpp.
◆ _generator
std::mt19937_64 NAV::RandomNumberGenerator::_generator |
|
private |
◆ seed
uint64_t NAV::RandomNumberGenerator::seed |
◆ useSeed
bool NAV::RandomNumberGenerator::useSeed |
The documentation for this class was generated from the following file: