Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
mtrandom.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "randombit_generator.h"
4 #include <random>
5 
6 namespace hgps {
7 
9 class MTRandom32 final : public RandomBitGenerator {
10  public:
12  MTRandom32();
13 
16  explicit MTRandom32(const unsigned int seed);
17 
18  unsigned int operator()() override;
19 
20  void seed(const unsigned int) override;
21 
22  void discard(const unsigned long long skip) override;
23 
24  double next_double() noexcept override;
25 
27  static constexpr unsigned int min() { return std::mt19937::min(); }
28 
30  static constexpr unsigned int max() { return std::mt19937::max(); }
31 
32  private:
33  std::mt19937 engine_;
34 };
35 } // namespace hgps
Mersenne Twister random number generator algorithm.
Definition: mtrandom.h:9
void seed(const unsigned int) override
Sets the current state of the generator engine.
Definition: mtrandom.cpp:17
static constexpr unsigned int min()
Gets the smallest possible value in the output range.
Definition: mtrandom.h:27
MTRandom32()
Initialise a new instance of the MTRandom32 class.
Definition: mtrandom.cpp:8
unsigned int operator()() override
Generates the next random number.
Definition: mtrandom.cpp:15
void discard(const unsigned long long skip) override
Advances the engine's state by a specified amount.
Definition: mtrandom.cpp:19
double next_double() noexcept override
Generates a random floating point number in range [0,1)
Definition: mtrandom.cpp:21
static constexpr unsigned int max()
Gets the largest possible value in the output range.
Definition: mtrandom.h:30
Pseudo-random number generator algorithm interface.
Definition: randombit_generator.h:9
Top-level namespace for Health-GPS C++ API.
Definition: analysis_definition.h:8