summary refs log tree commit diff stats
path: root/Source/Random.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Random.h')
-rw-r--r--Source/Random.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/Random.h b/Source/Random.h new file mode 100644 index 0000000..e4700f3 --- /dev/null +++ b/Source/Random.h
@@ -0,0 +1,17 @@
1#pragma once
2
3static int s_seed;
4
5class Random
6{
7public:
8 static void SetSeed(int seed) {
9 s_seed = seed;
10 }
11
12 static int RandInt(int min, int max) {
13 s_seed = (214013 * s_seed + 2531011) % 2147483648;
14 if (min == max) return min;
15 return (s_seed % (max - (min - 1))) + min;
16 }
17};