From 3adc18da877aa1a179d23b1a44163d62754f9e4a Mon Sep 17 00:00:00 2001 From: Sylae Corell Date: Thu, 17 Oct 2013 19:59:32 -0600 Subject: [PATCH] Seeding the PRNG on every call to it. Hopefully this will make things slightly more random. Seriously, Jeff? Why no seed? --- Blades of Exile/tools/mathutil.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Blades of Exile/tools/mathutil.cpp b/Blades of Exile/tools/mathutil.cpp index 8b807ced..fc732792 100644 --- a/Blades of Exile/tools/mathutil.cpp +++ b/Blades of Exile/tools/mathutil.cpp @@ -8,8 +8,8 @@ #include #include "mathutil.h" - -//minmax, move_to_zero and ex_abs (return absolute value) are templates in the header file + +//minmax, move_to_zero and ex_abs (return absolute value) are templates in the header file short get_ran (short times,short min,short max){ long int store; @@ -18,6 +18,7 @@ short get_ran (short times,short min,short max){ if(max < min) max = min; for (i = 1; i < times + 1; i++) { + srand(GetTickCount()); store = rand(); to_ret += min + (store % (max - min + 1));//min + (((store + 32767) * (max - min + 1)) / 65536); } @@ -53,4 +54,4 @@ short gcd(short a, short b){ // Grabbed from Wikipedia and translated to C code a = t; } return a; -} +}