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



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 814d80880 Fri Aug 24 01:51:28 2018 +0200 at mar 26 may 2026 12:30:59 CEST