From 73bc3d8ea49a4793b14976e86010a36f19c1d18b Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 9 Nov 2019 13:32:58 +0100 Subject: Core/Random: Refactor random number generation to use std::uniform_*_distribution to restrict result range instead of doing that ourselves * Seed SFMTRand with more values for its state --- src/common/Utilities/SFMTRand.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/common/Utilities/SFMTRand.h') diff --git a/src/common/Utilities/SFMTRand.h b/src/common/Utilities/SFMTRand.h index 2ed60d9a565..ec1cfb0bc6a 100644 --- a/src/common/Utilities/SFMTRand.h +++ b/src/common/Utilities/SFMTRand.h @@ -18,6 +18,7 @@ #ifndef SFMTRand_h__ #define SFMTRand_h__ +#include "Define.h" #include #include @@ -27,11 +28,7 @@ class SFMTRand { public: SFMTRand(); - void RandomInit(uint32_t seed); // Re-seed - int32_t IRandom(int32_t min, int32_t max); // Output random integer - uint32_t URandom(uint32_t min, uint32_t max); - double Random(); // Output random floating point number - uint32_t BRandom(); // Output random bits + uint32 RandomUInt32(); // Output random bits void* operator new(size_t size, std::nothrow_t const&); void operator delete(void* ptr, std::nothrow_t const&); void* operator new(size_t size); @@ -41,7 +38,7 @@ public: void* operator new[](size_t size); void operator delete[](void* ptr); private: - sfmt_t state; + sfmt_t _state; }; -#endif // SFMTRand_h__ \ No newline at end of file +#endif // SFMTRand_h__ -- cgit v1.2.3