Files
karl/include/simulation/random_numbers.h
2024-12-04 17:15:04 +01:00

28 lines
712 B
C++
Executable File

#ifndef RANDOM_NUMBERS_H
#define RANDOM_NUMBERS_H
#include <iostream>
#include <memory>
#include <random>
// class to handle a random generator object
class RandomNumbers {
public:
// Constructor: takes the seed for the random engine
RandomNumbers(int seed);
// draw a uniformly distributed integer number between min, max
int rollUniform(int min, int max);
// draw a uniformly distributed double number between min, max
double rollUniform(double min, double max);
// getter for the pointer to the mersenne twister 19937 engine
std::mt19937* engine();
private:
std::shared_ptr<std::mt19937> engine_;
std::uniform_real_distribution<double> real_distribution_;
};
#endif /* RANDOM_NUMBERS_H */