DUNE: Uniform Navigational Environment
2019.02.0
|
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 |
|
inlinevirtual |
Destructor.
|
static |
Generate an arbitrary seed value.
The kernel RNG facility '/dev/urandom' will be used for that purpose, if available.
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 | ( | void | ) |
Generate gaussian number with mean 0 and std.
dev 1. The number is generated using the Box-Muller method.
References uniform().
Referenced by ballG(), Simulators::IMU::Task::consume(), Simulators::Docking::Task::consume(), gaussian(), Simulators::USBL::Task::getSensorData(), Simulators::IMU::Task::onResourceAcquisition(), Simulators::LBL::Task::range(), Simulators::Target::Task::sendTarget(), Simulators::DepthSensor::Task::task(), Simulators::DVL::Task::task(), Simulators::CTD::Task::task(), Simulators::Gaussian::Task::task(), Simulators::Environment::Task::updateBottomDistance(), and Simulators::Environment::Task::updateForwardDistance().
|
inline |
Generate number with a Gaussian distribution, for a given mean and standard deviation.
mu | mean of distribution. |
sigma | std. dev. of distribution. |
References gaussian().
|
pure virtual |
Generate a 32-bit signed integer, uniformly distributed in [0,c_max_random].
Implemented in DUNE::Math::Random::KernelDevice, DUNE::Math::Random::TSGenerator< G >, DUNE::Math::Random::DRand48, DUNE::Math::Random::MT19937, and DUNE::Math::Random::FSR256.
Referenced by Simulators::LBL::Task::range(), Transports::Iridium::Task::sendAnnounce(), Transports::Iridium::Task::sendDeviceUpdates(), and uniform().
|
pure virtual |
Re-initialize generator with given seed.
value | value 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().
|
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().
|
inline |
Generate number with uniform distribution in a given interval.
a | value of a. |
b | value of b. |
References uniform().
|
static |
Maximum value returned by random()
Referenced by arbitrarySeed(), DUNE::Math::Random::DRand48::random(), DUNE::Math::Random::KernelDevice::random(), and DUNE::Math::Random::MT19937::seed().