Fixing a bug with the redone PRNG

Under the current system, it would have failed to be random if two calls
were made during the same msec. It will now throw in the previous rand()
in the new seed, which should prevent duplicates (although the next seed
in the same msec will be predictable, it's not like we need to be
cryptographically secure here)
This commit is contained in:
Sylae Corell
2013-10-19 14:39:10 -06:00
parent 60326e8cea
commit 75970023b7

View File

@@ -18,7 +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());
srand(GetTickCount() + rand());
store = rand();
to_ret += min + (store % (max - min + 1));//min + (((store + 32767) * (max - min + 1)) / 65536);
}