Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
random_algorithm.h
Go to the documentation of this file.
1#pragma once
2
3#include "mtrandom.h"
4#include <functional>
5
6namespace hgps {
8class Random {
9 public:
12 void seed(unsigned int seed) noexcept;
13
16 int next_int();
17
21 int next_int(int max_value);
22
27 int next_int(int min_value, int max_value);
28
31 double next_double() noexcept;
32
35 double next_normal();
36
41 double next_normal(double mean, double standard_deviation);
42
47 int next_empirical_discrete(const std::vector<int> &values, const std::vector<float> &cdf);
48
53 int next_empirical_discrete(const std::vector<int> &values, const std::vector<double> &cdf);
54
55 private:
56 MTRandom32 engine_;
57
58 int next_int_internal(int min_value, int max_value);
59 double next_uniform_internal(double min_value, double max_value);
60 double next_normal_internal(double mean, double standard_deviation);
61};
62} // namespace hgps
Mersenne Twister random number generator algorithm.
Definition mtrandom.h:9
General purpose Random number generator algorithms.
Definition random_algorithm.h:8
double next_double() noexcept
Generates a random floating point number in range [0,1)
Definition random_algorithm.cpp:28
double next_normal()
Generates the next random number from a standard normal distribution.
Definition random_algorithm.cpp:30
int next_int()
Generates the next random integer in the sequence.
Definition random_algorithm.cpp:12
int next_empirical_discrete(const std::vector< int > &values, const std::vector< float > &cdf)
Samples a random value from an empirical distribution.
Definition random_algorithm.cpp:43
void seed(unsigned int seed) noexcept
Set a new seed value for the random number generator.
Definition random_algorithm.cpp:10
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:8