replace rand() and srand(). fix #390

This commit is contained in:
2024-08-07 13:14:56 -05:00
committed by Celtic Minstrel
parent a1022aa23b
commit fc12092a1b
6 changed files with 16 additions and 9 deletions

View File

@@ -9,6 +9,9 @@
#include <cstdlib>
#include "mathutil.hpp"
std::mt19937 game_rand;
std::mt19937 ui_rand;
short get_ran (short times,short min,short max){
long int store;
short to_ret = 0;
@@ -17,7 +20,7 @@ short get_ran (short times,short min,short max){
if(max == min) return times * min;
for(short i = 1; i < times + 1; i++) {
store = rand();
store = game_rand();
to_ret += min + (store % (max - min + 1));
}
return to_ret;