DUNE: Uniform Navigational Environment  2019.02.1
DUNE::Math::Random::Generator Class Referenceabstract

Detailed Description

Base abstract class for random number generators.

Classes

class  Error
 

Public Member Functions

virtual ~Generator ()
 
virtual void seed (int32_t value)=0
 
virtual int32_t random (void)=0
 
virtual double uniform (void)
 
double uniform (double a, double b)
 
double gaussian (void)
 
double gaussian (double mu, double sigma)
 
void ballU (double radius, double *x, double *y)
 
void ballG (double sigma, double *x, double *y)
 

Static Public Member Functions

static int32_t arbitrarySeed (void)
 

Static Public Attributes

static const int32_t c_max_random
 

Constructor & Destructor Documentation

virtual DUNE::Math::Random::Generator::~Generator ( )
inlinevirtual

Destructor.

Member Function Documentation

int32_t DUNE::Math::Random::Generator::arbitrarySeed ( void  )
static

Generate an arbitrary seed value.

The kernel RNG facility '/dev/urandom' will be used for that purpose, if available.

Returns
generated seed value.

References DUNE::Math::Random::KernelDevice::available(), c_max_random, DUNE::Time::Clock::get(), DUNE::Math::Random::KernelDevice::random(), and seed().

Referenced by DUNE::Math::Random::Factory::create(), DUNE::Math::Random::DRand48::DRand48(), DUNE::Math::Random::FSR256::FSR256(), and DUNE::Math::Random::MT19937::MT19937().

void DUNE::Math::Random::Generator::ballG ( double  sigma,
double *  x,
double *  y 
)

References gaussian(), and uniform().

Referenced by gaussian().

void DUNE::Math::Random::Generator::ballU ( double  radius,
double *  x,
double *  y 
)

References uniform().

Referenced by gaussian().

double DUNE::Math::Random::Generator::gaussian ( double  mu,
double  sigma 
)
inline

Generate number with a Gaussian distribution, for a given mean and standard deviation.

Parameters
mumean of distribution.
sigmastd. dev. of distribution.
Returns
number with gaussian distribution (mu,sigma).

References ballG(), ballU(), and gaussian().

virtual int32_t DUNE::Math::Random::Generator::random ( void  )
pure virtual
virtual void DUNE::Math::Random::Generator::seed ( int32_t  value)
pure virtual

Re-initialize generator with given seed.

Parameters
valuevalue for seed.

Implemented in DUNE::Math::Random::KernelDevice, DUNE::Math::Random::MT19937, DUNE::Math::Random::DRand48, DUNE::Math::Random::TSGenerator< G >, and DUNE::Math::Random::FSR256.

Referenced by arbitrarySeed().

double DUNE::Math::Random::Generator::uniform ( void  )
virtual

Generate double-precision floating point number with uniform distribution in [0,1].

Default implementation returns value of random()/c_max_random.

Reimplemented in DUNE::Math::Random::KernelDevice, DUNE::Math::Random::TSGenerator< G >, and DUNE::Math::Random::MT19937.

References random().

Referenced by ballG(), ballU(), Simulators::Servos::Task::consume(), gaussian(), Simulators::Target::Task::sendTarget(), Simulators::DVL::Task::task(), and uniform().

double DUNE::Math::Random::Generator::uniform ( double  a,
double  b 
)
inline

Generate number with uniform distribution in a given interval.

Parameters
avalue of a.
bvalue of b.
Returns
number with uniform distribution in [a,b].

References gaussian(), and uniform().

Member Data Documentation

const int32_t DUNE::Math::Random::Generator::c_max_random
static
Collaboration diagram for DUNE::Math::Random::Generator:
Collaboration graph