Newer
Older
/*
* random.hpp
*
* Created on: May 28, 2015
* Author: Jan Travnicek
*/
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
namespace std {
class random_devices {
public:
static random_device random;
private:
class semirandom_device {
public:
typedef unsigned int result_type;
private:
std::mt19937 gen;
std::uniform_int_distribution<unsigned int> dis;
public:
semirandom_device() : gen(random_devices::random()) {
}
result_type operator()() {
return dis(gen);
}
result_type min() {
return 0;
}
result_type max() {
return numeric_limits<result_type>::max() ;
}
};
public:
static semirandom_device semirandom;
};
} /* namespace std */