From a2913485f2b072f0f3c531b9ef2e89ed066ec128 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Mon, 5 Nov 2018 07:21:05 -0800 Subject: Fix RNG not changing --- Source/Random.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'Source/Random.h') diff --git a/Source/Random.h b/Source/Random.h index 40998de..179f0fa 100644 --- a/Source/Random.h +++ b/Source/Random.h @@ -1,18 +1,12 @@ #pragma once -#include - -static int s_seed = time(nullptr); // Seed from the time in milliseconds +#include class Random { public: - static void SetSeed(int seed) { - s_seed = seed; - } + static void SetSeed(int seed); + static int RandInt(int min, int max); - 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; - } +private: + static int s_seed; }; -- cgit 1.4.1