blob: f6ae887a87822bd1ca1577e34f5e5ce544362c74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#pragma once
#include "Range.h"
#include <random>
class RNG {
public:
static RNG & get();
static std::mt19937 & get_engine();
public:
int rand_int(const int upper);
//! \note upper is non-inclusive
int rand_int(const int lower, const int upper);
//! \note range is inclusive
int rand_int(const Range<int> range);
double rand_double();
double rand_double(const double lower, const double upper);
bool rand_bool();
private:
RNG();
private:
std::random_device dev;
std::mt19937 rng;
};
|