diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-27 13:41:27 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-27 13:41:27 -0400 |
commit | dde56d26837dc52e05207c0672b3c4a1046f6cb2 (patch) | |
tree | 6e2429bfb180b4ce20374bb00b319bbeda9da86c /ext/wittle_generator/Random.h | |
download | wittle-dde56d26837dc52e05207c0672b3c4a1046f6cb2.tar.gz wittle-dde56d26837dc52e05207c0672b3c4a1046f6cb2.tar.bz2 wittle-dde56d26837dc52e05207c0672b3c4a1046f6cb2.zip |
pulled out generation logic from sigma's rando
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 */ | ||