GEGELATI

Loading...
Searching...
No Matches
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
Mutator::RNG
Definition rng.h:52
Mutator::RNG::engine
std::unique_ptr< std::mt19937_64 > engine
Mersenne twister MT19937 engine used for Random Number generation.
Definition rng.h:55
Mutator::RNG::RNG
RNG(const RNG &other)
Copy constructor.
Definition rng.h:73
Mutator::RNG::RNG
RNG(uint64_t seed=0)
Default seeding constructor for RNG.
Definition rng.h:63
Mutator::RNG::getInt32
int32_t getInt32(int32_t min, int32_t max)
Get a pseudo random int number between two bounds (included).
Definition rng.cpp:50
Mutator::RNG::getUnsignedInt64
uint64_t getUnsignedInt64(uint64_t min, uint64_t max)
Get a pseudo random int number between two bounds (included).
Definition rng.cpp:44
Mutator::RNG::getDouble
double getDouble(double min, double max)
Get a pseudo random double number between two bounds (included).
Definition rng.cpp:56
Mutator::RNG::setSeed
void setSeed(uint64_t seed)
Set the seed of the random number generator.
Definition rng.cpp:39
Mutator
Definition deterministicRandom.h:44