added mutex for RNG, moved game command implementation from S_PH to S_Player in preparation for forwarding of game commands via tunneling interface

This commit is contained in:
Max-Wilhelm Bruker 2012-03-17 22:26:12 +01:00
parent 671214c60e
commit 9706ecd98a
11 changed files with 1090 additions and 1092 deletions

View file

@ -17,6 +17,9 @@ RNG_SFMT::RNG_SFMT(QObject *parent)
unsigned int RNG_SFMT::getNumber(unsigned int min, unsigned int max)
{
mutex.lock();
uint64_t r = gen_rand64();
mutex.unlock();
return min + (unsigned int) (((double) (max + 1 - min)) * r / (18446744073709551616.0 + 1.0));
}