mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
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:
parent
671214c60e
commit
9706ecd98a
11 changed files with 1090 additions and 1092 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue