Quantum++  v0.7
C++11 quantum computing library
random_devices.h
Go to the documentation of this file.
1 /*
2  * Quantum++
3  *
4  * Copyright (c) 2013 - 2015 Vlad Gheorghiu (vgheorgh@gmail.com)
5  *
6  * This file is part of Quantum++.
7  *
8  * Quantum++ is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * Quantum++ is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Quantum++. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
27 #ifndef CLASSES_RANDOM_DEVICES_H_
28 #define CLASSES_RANDOM_DEVICES_H_
29 
30 namespace qpp
31 {
32 
46 class RandomDevices : public internal::Singleton<RandomDevices> // Singleton
47 {
49 
50  std::random_device _rd;
51 public:
52  std::mt19937 _rng;
53 private:
57  RandomDevices() : _rd{}, _rng{_rd()}
58  {
59  }
60 
64  ~RandomDevices() = default;
65 }; /* class RandomDevices */
66 
67 } /* namespace qpp */
68 
69 #endif /* CLASSES_RANDOM_DEVICES_H_ */
std::mt19937 _rng
Mersenne twister random number generator.
Definition: random_devices.h:52
Singleton policy class, used internally to implement the singleton pattern via CRTP (Curiously recurr...
Definition: singleton.h:77
Quantum++ main namespace.
Definition: codes.h:30
Singeleton class that manages the source of randomness in the library.
Definition: random_devices.h:46