0.2.0
Loading...
Searching...
No Matches
NAV::RandomNumberGenerator Class Reference

Manages a thread which calls a specified function at a specified interval. More...

Public Member Functions

template<typename RealType = double>
double getRand_normalDist (RealType mean=0.0, RealType stddev=1.0)
 Gets a random number from a normal distribution.
 
template<typename IntType = int>
double getRand_uniformIntDist (IntType min=0, IntType max=std::numeric_limits< IntType >::max())
 Gets a random integer number from an uniform distribution.
 
template<typename RealType = double>
double getRand_uniformRealDist (RealType min=0.0, RealType max=1.0)
 Gets a random real number from an uniform distribution.
 
RandomNumberGeneratoroperator= (const RandomNumberGenerator &)=delete
 Copy assignment operator.
 
RandomNumberGeneratoroperator= (RandomNumberGenerator &&)=delete
 Move assignment operator.
 
 RandomNumberGenerator (bool useSeed=true)
 Default constructor.
 
 RandomNumberGenerator (const RandomNumberGenerator &)=delete
 Copy constructor.
 
 RandomNumberGenerator (RandomNumberGenerator &&)=delete
 Move constructor.
 
void resetSeed (size_t id=0)
 Reset the seed to the internal seed or the system time.
 
void resetSeedOnce (uint64_t userSeed)
 Reset the seed to the specified seed, but do not update the internal seed.
 
 ~RandomNumberGenerator ()=default
 Destructor.
 

Public Attributes

uint64_t seed
 Seed for the random number generator.
 
bool useSeed
 Flag whether to use the seed instead of the system time.
 

Detailed Description

Manages a thread which calls a specified function at a specified interval.

Member Function Documentation

◆ 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
RealTypeThe result type generated by the generator. The effect is undefined if this is not one of float, double, or long double
Parameters
meanThe μ distribution parameter (mean)
stddevThe σ distribution parameter (standard deviation)
Returns
Random number

◆ 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
IntTypeThe 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
minMinimum value
maxMaximum value
Returns
Random number

◆ 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
RealTypeThe result type generated by the generator. The effect is undefined if this is not one of float, double, or long double
Parameters
minMinimum value
maxMaximum value
Returns
Random number

◆ resetSeed()

void NAV::RandomNumberGenerator::resetSeed ( size_t id = 0)
inline

Reset the seed to the internal seed or the system time.

Parameters
idSome id used to make a unique hash when using the system time to set the seed

◆ 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]userSeedSeed to use once

The documentation for this class was generated from the following file: