Main MRPT website > C++ reference for MRPT 1.9.9
RandomGenerator.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "random-precomp.h" // Precompiled headers
11 
13 
14 using namespace mrpt::random;
15 
16 // The global instance of CRandomGenerator for single-thread programs:
18 
20 // MT19937 algorithm
21 // http://en.wikipedia.org/wiki/Mersenne_twister
22 // Initialize the generator from a seed
24 {
25  m_MT19937.seed(seed);
26 }
27 
29 // MT19937 algorithm
30 // http://en.wikipedia.org/wiki/Mersenne_twister
33 {
35 }
36 
38 {
39  MT19937_initializeGenerator(std::random_device{}());
40 }
41 
43 {
45 }
mrpt::random::CRandomGenerator::randomize
void randomize()
Randomize the generators, based on std::random_device.
Definition: RandomGenerator.cpp:37
mrpt::random::CRandomGenerator::drawGaussian1D_normalized
double drawGaussian1D_normalized()
Generate a normalized (mean=0, std=1) normally distributed sample.
Definition: RandomGenerator.cpp:42
random-precomp.h
mrpt::random::CRandomGenerator
A thred-safe pseudo random number generator, based on an internal MT19937 randomness generator.
Definition: RandomGenerators.h:47
mrpt::random::CRandomGenerator::drawUniform64bit
uint64_t drawUniform64bit()
Returns a uniformly distributed pseudo-random number by joining two 32bit numbers from drawUniform32b...
Definition: RandomGenerator.cpp:28
randomGenerator
static CRandomGenerator randomGenerator
Definition: RandomGenerator.cpp:17
mrpt::random::CRandomGenerator::m_uint64
std::uniform_int_distribution< uint64_t > m_uint64
Definition: RandomGenerators.h:55
uint64_t
unsigned __int64 uint64_t
Definition: rptypes.h:50
mrpt::random::CRandomGenerator::m_MT19937
std::mt19937_64 m_MT19937
Data used internally by the MT19937 PRNG algorithm.
Definition: RandomGenerators.h:51
RandomGenerators.h
mrpt::random::getRandomGenerator
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
Definition: RandomGenerator.cpp:19
mrpt::random
A namespace of pseudo-random numbers generators of diferent distributions.
Definition: random_shuffle.h:17
mrpt::random::CRandomGenerator::MT19937_initializeGenerator
void MT19937_initializeGenerator(const uint32_t &seed)
Definition: RandomGenerator.cpp:23
mrpt::random::CRandomGenerator::m_uint32
std::uniform_int_distribution< uint32_t > m_uint32
Definition: RandomGenerators.h:54
uint32_t
unsigned __int32 uint32_t
Definition: rptypes.h:47
mrpt::random::CRandomGenerator::drawUniform32bit
uint32_t drawUniform32bit()
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm,...
Definition: RandomGenerator.cpp:31
mrpt::random::CRandomGenerator::m_normdistribution
std::normal_distribution< double > m_normdistribution
Definition: RandomGenerators.h:53



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST