Quantum++
v1.0-rc3
A modern C++11 quantum computing library
|
Singleton class that manages the source of randomness in the library. More...
#include <classes/random_devices.h>
Public Member Functions | |
std::mt19937 & | get_prng () |
Returns a reference to the internal PRNG object. More... | |
std::istream & | load (std::istream &is) |
Loads the state of the PRNG from an input stream. More... | |
std::ostream & | save (std::ostream &os) const |
Saves the state of the PRNG to an output stream. More... | |
Private Member Functions | |
RandomDevices () | |
Initializes and seeds the random number generators. More... | |
~RandomDevices ()=default | |
Default destructor. More... | |
Private Attributes | |
std::random_device | rd_ |
used to seed std::mt19937 prng_ More... | |
std::mt19937 | prng_ |
Mersenne twister random number generator. More... | |
Friends | |
class | internal::Singleton< RandomDevices > |
Additional Inherited Members | |
![]() | |
static RandomDevices & | get_instance () noexcept(std::is_nothrow_constructible< RandomDevices >::value) |
static RandomDevices & | get_thread_local_instance () noexcept(std::is_nothrow_constructible< RandomDevices >::value) |
![]() | |
Singleton () noexcept=default | |
Singleton (const Singleton &)=delete | |
Singleton & | operator= (const Singleton &)=delete |
virtual | ~Singleton ()=default |
Singleton class that manages the source of randomness in the library.
Consists of a wrapper around an std::mt19937 Mersenne twister random number generator engine and an std::random_device engine. The latter is used to seed the Mersenne twister.
|
inlineprivate |
Initializes and seeds the random number generators.
|
privatedefault |
Default destructor.
|
inline |
Returns a reference to the internal PRNG object.
|
inline |
Loads the state of the PRNG from an input stream.
is | Input stream |
|
inline |
Saves the state of the PRNG to an output stream.
os | Output stream |
|
friend |
|
private |
Mersenne twister random number generator.
|
private |
used to seed std::mt19937 prng_