summaryrefslogtreecommitdiffstats
path: root/src/FastRandom.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-03-14 22:52:13 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-03-14 22:52:13 +0100
commita8a2d3d504a84f26d71aa364a169963a70ce6288 (patch)
tree7f98e49edd77dfbb115657ae1d7506c0158678b1 /src/FastRandom.cpp
parentFixed grass spread, closes #1743 (diff)
downloadcuberite-a8a2d3d504a84f26d71aa364a169963a70ce6288.tar
cuberite-a8a2d3d504a84f26d71aa364a169963a70ce6288.tar.gz
cuberite-a8a2d3d504a84f26d71aa364a169963a70ce6288.tar.bz2
cuberite-a8a2d3d504a84f26d71aa364a169963a70ce6288.tar.lz
cuberite-a8a2d3d504a84f26d71aa364a169963a70ce6288.tar.xz
cuberite-a8a2d3d504a84f26d71aa364a169963a70ce6288.tar.zst
cuberite-a8a2d3d504a84f26d71aa364a169963a70ce6288.zip
Diffstat (limited to '')
-rw-r--r--src/FastRandom.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/FastRandom.cpp b/src/FastRandom.cpp
index ad1390a92..737b13535 100644
--- a/src/FastRandom.cpp
+++ b/src/FastRandom.cpp
@@ -6,6 +6,12 @@
#include "Globals.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) :
- 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() :
- m_MersenneRand(static_cast<unsigned>(std::chrono::system_clock::now().time_since_epoch().count()))
+ m_MersenneRand(m_Counter++)
{
}