mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-02 15:17:27 +01:00
* Remove support for map-based random number generation (which seems unused).
* Re-add in support for the old mersenne twister for those whose processors don't support SSE2. * Toggling whether or not you are using SFMT is as easy as checking a CMake flag, USE_SFMT, which defaults to 0. --HG-- branch : trunk
This commit is contained in:
@@ -22,9 +22,14 @@
|
||||
|
||||
#include "socket_include.h"
|
||||
#include "utf8.h"
|
||||
#ifdef USE_SFMT_FOR_RNG
|
||||
#include "SFMT.h"
|
||||
#else
|
||||
#include "MersenneTwister.h"
|
||||
#endif
|
||||
#include <ace/TSS_T.h>
|
||||
|
||||
#ifdef USE_SFMT_FOR_RNG
|
||||
typedef ACE_TSS<SFMTRand> SFMTRandTSS;
|
||||
static SFMTRandTSS sfmtRand;
|
||||
|
||||
@@ -52,6 +57,35 @@ double rand_chance (void)
|
||||
{
|
||||
return sfmtRand->Random() * 100.0;
|
||||
}
|
||||
#else
|
||||
typedef ACE_TSS<MTRand> MTRandTSS;
|
||||
static MTRandTSS mtRand;
|
||||
|
||||
int32 irand(int32 min, int32 max)
|
||||
{
|
||||
return int32(mtRand->randInt (max - min)) + min;
|
||||
}
|
||||
|
||||
uint32 urand(uint32 min, uint32 max)
|
||||
{
|
||||
return mtRand->randInt (max - min) + min;
|
||||
}
|
||||
|
||||
int32 rand32()
|
||||
{
|
||||
return mtRand->randInt ();
|
||||
}
|
||||
|
||||
double rand_norm(void)
|
||||
{
|
||||
return mtRand->randExc();
|
||||
}
|
||||
|
||||
double rand_chance(void)
|
||||
{
|
||||
return mtRand->randExc(100.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
Tokens StrSplit(const std::string &src, const std::string &sep)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user