Use thread_local in cFastRandom
This commit is contained in:
parent
e94886c140
commit
a8a2d3d504
@ -6,6 +6,12 @@
|
|||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "FastRandom.h"
|
#include "FastRandom.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define thread_local __declspec(thread)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
thread_local unsigned int m_Counter = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -86,7 +92,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
cFastRandom::cFastRandom(void) :
|
cFastRandom::cFastRandom(void) :
|
||||||
m_LinearRand(static_cast<unsigned>(std::chrono::system_clock::now().time_since_epoch().count()))
|
m_LinearRand(m_Counter++)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +136,7 @@ int cFastRandom::GenerateRandomInteger(int a_Begin, int a_End)
|
|||||||
// MTRand:
|
// MTRand:
|
||||||
|
|
||||||
MTRand::MTRand() :
|
MTRand::MTRand() :
|
||||||
m_MersenneRand(static_cast<unsigned>(std::chrono::system_clock::now().time_since_epoch().count()))
|
m_MersenneRand(m_Counter++)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user