Quantum++  v0.8
C++11 quantum computing library
qpp::RandomDevices Class Referencefinal

Singeleton class that manages the source of randomness in the library. More...

#include <classes/random_devices.h>

Inheritance diagram for qpp::RandomDevices:
Collaboration diagram for qpp::RandomDevices:

Public Attributes

std::mt19937 _rng
 Mersenne twister random number generator. 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 _rng More...
 

Friends

class internal::Singleton< RandomDevices >
 

Additional Inherited Members

- Static Public Member Functions inherited from qpp::internal::Singleton< RandomDevices >
static RandomDevicesget_instance () noexcept(std::is_nothrow_constructible< RandomDevices >::value)
 
static thread_local RandomDevicesget_thread_local_instance () noexcept(std::is_nothrow_constructible< RandomDevices >::value)
 
- Protected Member Functions inherited from qpp::internal::Singleton< RandomDevices >
 Singleton () noexcept=default
 
 Singleton (const Singleton &)=delete
 
Singletonoperator= (const Singleton &)=delete
 
virtual ~Singleton ()=default
 

Detailed Description

Singeleton 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.

Warning
This class DOES NOT seed the standard C number generator used by Eigen::Matrix::Random(), since it is not thread safe. Do not use Eigen::Matrix::Random() or functions that depend on the C style random number engine, but use qpp::rand() instead!

Constructor & Destructor Documentation

qpp::RandomDevices::RandomDevices ( )
inlineprivate

Initializes and seeds the random number generators.

qpp::RandomDevices::~RandomDevices ( )
privatedefault

Default destructor.

Friends And Related Function Documentation

friend class internal::Singleton< RandomDevices >
friend

Member Data Documentation

std::random_device qpp::RandomDevices::_rd
private

used to seed std::mt19937 _rng

std::mt19937 qpp::RandomDevices::_rng

Mersenne twister random number generator.


The documentation for this class was generated from the following file: