GEGELATI
rng.h
1
36#ifndef RNG_H
37#define RNG_H
38
39#include <memory>
40#include <random>
41
42namespace Mutator {
43
51 class RNG
52 {
53 protected:
55 std::unique_ptr<std::mt19937_64> engine;
56
57 public:
63 RNG(uint64_t seed = 0) : engine(std::make_unique<std::mt19937_64>(seed))
64 {
65 }
66
73 RNG(const RNG& other)
74 : engine(std::make_unique<std::mt19937_64>(*(other.engine)))
75 {
76 }
77
83 void setSeed(uint64_t seed);
84
92 uint64_t getUnsignedInt64(uint64_t min, uint64_t max);
93
101 int32_t getInt32(int32_t min, int32_t max);
102
111 double getDouble(double min, double max);
112 };
113}; // namespace Mutator
114
115#endif
Definition: rng.h:52
std::unique_ptr< std::mt19937_64 > engine
Mersenne twister MT19937 engine used for Random Number generation.
Definition: rng.h:55
RNG(const RNG &other)
Copy constructor.
Definition: rng.h:73
RNG(uint64_t seed=0)
Default seeding constructor for RNG.
Definition: rng.h:63
int32_t getInt32(int32_t min, int32_t max)
Get a pseudo random int number between two bounds (included).
Definition: rng.cpp:50
uint64_t getUnsignedInt64(uint64_t min, uint64_t max)
Get a pseudo random int number between two bounds (included).
Definition: rng.cpp:44
double getDouble(double min, double max)
Get a pseudo random double number between two bounds (included).
Definition: rng.cpp:56
void setSeed(uint64_t seed)
Set the seed of the random number generator.
Definition: rng.cpp:39
Definition: deterministicRandom.h:44