32 #ifndef CLASSES_RANDOM_DEVICES_H_ 33 #define CLASSES_RANDOM_DEVICES_H_ 54 std::random_device
rd_;
68 std::istream&
load(std::istream& is) {
return is >>
prng_; }
75 std::ostream&
save(std::ostream& os)
const {
return os <<
prng_; }
std::mt19937 & get_prng()
Returns a reference to the internal PRNG object.
Definition: random_devices.h:61
Singleton policy class, used internally to implement the singleton pattern via CRTP (Curiously recurr...
Definition: singleton.h:80
std::ostream & save(std::ostream &os) const
Saves the state of the PRNG to an output stream.
Definition: random_devices.h:75
Quantum++ main namespace.
Definition: codes.h:35
RandomDevices()
Initializes and seeds the random number generators.
Definition: random_devices.h:81
Singleton class that manages the source of randomness in the library.
Definition: random_devices.h:49
std::random_device rd_
used to seed std::mt19937 prng_
Definition: random_devices.h:54
std::istream & load(std::istream &is)
Loads the state of the PRNG from an input stream.
Definition: random_devices.h:68
std::mt19937 prng_
Mersenne twister random number generator.
Definition: random_devices.h:55
~RandomDevices()=default
Default destructor.