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

Detailed Description

Base abstract class for random number generators.


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 ( )


Member Function Documentation

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

Generate an arbitrary seed value.

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

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().

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

References uniform().

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

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

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

References 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.

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  )

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 

Generate number with uniform distribution in a given interval.

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

References uniform().

Member Data Documentation

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