Molassembler  1.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Prng.h
Go to the documentation of this file.
1 
8 #ifndef INCLUDE_MOLASSEMBLER_PRNG_H
9 #define INCLUDE_MOLASSEMBLER_PRNG_H
10 
11 #include "Molassembler/Export.h"
12 #include <memory>
13 #include <vector>
14 
15 namespace Scine {
16 namespace Molassembler {
17 
21 namespace Random {
22 
24 class MASM_EXPORT Engine {
25 public:
27  using result_type = uint32_t;
28 
29  explicit Engine();
30  explicit Engine(int seedArg);
31  Engine(Engine&& other) noexcept;
32  Engine& operator = (Engine&& other) noexcept;
33  Engine(const Engine& other);
34  Engine& operator = (const Engine& other);
35  ~Engine();
36 
38  static constexpr result_type min() {
39  return 0;
40  }
41 
43  static constexpr result_type max() {
44  return ~result_type(0);
45  }
46 
48  void seed(int x);
49 
51  void seed(const std::vector<int>& signedSeeds);
52 
57  result_type operator() () const;
58 
60  bool operator == (const Engine& other) const;
61 
62 private:
63  struct Impl;
64  std::unique_ptr<Impl> pImpl_;
65 };
66 
67 } // namespace Random
68 } // namespace Molassembler
69 } // namespace Scine
70 
71 #endif
Drives a PRNG.
Definition: Prng.h:24
uint32_t result_type
The type this engine generates.
Definition: Prng.h:27
static constexpr result_type max()
Maximum value of result_type.
Definition: Prng.h:43