diff options
Diffstat (limited to 'ext/wittle_generator/Random.h')
-rw-r--r-- | ext/wittle_generator/Random.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/wittle_generator/Random.h b/ext/wittle_generator/Random.h new file mode 100644 index 0000000..115c62d --- /dev/null +++ b/ext/wittle_generator/Random.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef RANDOM_H_F3423EE7 | ||
2 | #define RANDOM_H_F3423EE7 | ||
3 | |||
4 | #include <stdlib.h> | ||
5 | |||
6 | #include <random> | ||
7 | |||
8 | struct Random { | ||
9 | static std::mt19937 gen; | ||
10 | |||
11 | static void seed(int val) { gen = std::mt19937(val); } | ||
12 | |||
13 | static int rand() { return abs((int)gen()); } | ||
14 | }; | ||
15 | |||
16 | #endif /* end of include guard: RANDOM_H_F3423EE7 */ | ||