about summary refs log tree commit diff stats
path: root/Source/Random.h
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-10-30 20:00:32 -0700
committerjbzdarkid <jbzdarkid@gmail.com>2018-10-30 20:00:32 -0700
commite66a408e38849107a3d35a317ff6f2b23dcaeead (patch)
tree2e2abb9c80997c0565fddce4e7e271d901839b26 /Source/Random.h
parent2ec4950107245df8f01860a3289b7731753933cd (diff)
downloadwitness-tutorializer-e66a408e38849107a3d35a317ff6f2b23dcaeead.tar.gz
witness-tutorializer-e66a408e38849107a3d35a317ff6f2b23dcaeead.tar.bz2
witness-tutorializer-e66a408e38849107a3d35a317ff6f2b23dcaeead.zip
RM static cast, lower warning level, add homebrew RNG
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};