From e66a408e38849107a3d35a317ff6f2b23dcaeead Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Tue, 30 Oct 2018 20:00:32 -0700 Subject: RM static cast, lower warning level, add homebrew RNG --- Source/Random.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Source/Random.h (limited to 'Source/Random.h') 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 @@ +#pragma once + +static int s_seed; + +class Random +{ +public: + static void SetSeed(int seed) { + s_seed = seed; + } + + static int RandInt(int min, int max) { + s_seed = (214013 * s_seed + 2531011) % 2147483648; + if (min == max) return min; + return (s_seed % (max - (min - 1))) + min; + } +}; -- cgit 1.4.1