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 }
A namespace of pseudo-random numbers generators of diferent distributions.
uint32_t drawUniform32bit()
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm, in the whole range of 32-bit integers.
std::uniform_int_distribution< uint64_t > m_uint64
std::normal_distribution< double > m_normdistribution
A thred-safe pseudo random number generator, based on an internal MT19937 randomness generator...
static CRandomGenerator randomGenerator
std::mt19937_64 m_MT19937
Data used internally by the MT19937 PRNG algorithm.
uint64_t drawUniform64bit()
Returns a uniformly distributed pseudo-random number by joining two 32bit numbers from drawUniform32b...
unsigned __int64 uint64_t
Definition: rptypes.h:50
void randomize()
Randomize the generators, based on std::random_device.
void MT19937_initializeGenerator(const uint32_t &seed)
std::uniform_int_distribution< uint32_t > m_uint32
unsigned __int32 uint32_t
Definition: rptypes.h:47
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
double drawGaussian1D_normalized()
Generate a normalized (mean=0, std=1) normally distributed sample.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019