aboutsummaryrefslogtreecommitdiff
path: root/src/shared/Util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/Util.cpp')
-rw-r--r--src/shared/Util.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/shared/Util.cpp b/src/shared/Util.cpp
index 767b65e441c..ac57fc3c9e9 100644
--- a/src/shared/Util.cpp
+++ b/src/shared/Util.cpp
@@ -23,40 +23,34 @@
#include "sockets/socket_include.h"
#include "utf8cpp/utf8.h"
#include "mersennetwister/MersenneTwister.h"
-#include "zthread/ThreadLocal.h"
+#include <ace/TSS_T.h>
-typedef ZThread::ThreadLocal<MTRand> MTRandTSS;
-
-/* NOTE: Not sure if static initialization is ok for TSS objects ,
- * as I see zthread uses custom implementation of the TSS
- * ,and in the consturctor there is no code ,so I suppose its ok
- * If its not ok ,change it to use singleton.
- */
+typedef ACE_TSS<MTRand> MTRandTSS;
static MTRandTSS mtRand;
int32 irand (int32 min, int32 max)
{
- return int32 (mtRand.get ().randInt (max - min)) + min;
+ return int32 (mtRand->randInt (max - min)) + min;
}
uint32 urand (uint32 min, uint32 max)
{
- return mtRand.get ().randInt (max - min) + min;
+ return mtRand->randInt (max - min) + min;
}
int32 rand32 ()
{
- return mtRand.get ().randInt ();
+ return mtRand->randInt ();
}
double rand_norm(void)
{
- return mtRand.get ().randExc ();
+ return mtRand->randExc ();
}
double rand_chance (void)
{
- return mtRand.get ().randExc (100.0);
+ return mtRand->randExc (100.0);
}
Tokens StrSplit(const std::string &src, const std::string &sep)