Defines Drake's canonical implementation of the UniformRandomBitGenerator C++ concept (as well as a few conventional extras beyond the concept, e.g., seeds).
This uses the 32-bit Mersenne Twister mt19937 by Matsumoto and Nishimura, 1998. For more information, see https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine
#include <drake/common/random.h>
Public Types | |
using | result_type = std::mt19937::result_type |
Public Member Functions | |
RandomGenerator ()=default | |
Creates a generator using the default_seed . More... | |
RandomGenerator (result_type seed) | |
Creates a generator using given seed . More... | |
result_type | operator() () |
Generates a pseudo-random value. More... | |
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable | |
RandomGenerator (const RandomGenerator &)=default | |
RandomGenerator & | operator= (const RandomGenerator &)=default |
RandomGenerator (RandomGenerator &&)=default | |
RandomGenerator & | operator= (RandomGenerator &&)=default |
Static Public Member Functions | |
static constexpr result_type | min () |
static constexpr result_type | max () |
Static Public Attributes | |
static constexpr result_type | default_seed = std::mt19937::default_seed |
using result_type = std::mt19937::result_type |
|
default |
|
default |
|
default |
Creates a generator using the default_seed
.
Actual creation of the generator is deferred until first use so this constructor is fast and does not allocate any heap memory.
|
explicit |
Creates a generator using given seed
.
|
static |
|
static |
result_type operator() | ( | ) |
Generates a pseudo-random value.
|
default |
|
default |
|
static |