aboutsummaryrefslogtreecommitdiff
path: root/src/common/Utilities/SFMTRand.h
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2019-11-09 13:32:58 +0100
committerShauren <shauren.trinity@gmail.com>2019-11-09 15:09:22 +0100
commit73bc3d8ea49a4793b14976e86010a36f19c1d18b (patch)
tree4d24a1bbbc757175633eaab2d65012570efa6a67 /src/common/Utilities/SFMTRand.h
parent4e0279b0e48c9992842010b9f3f132e54a460128 (diff)
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
Diffstat (limited to 'src/common/Utilities/SFMTRand.h')
-rw-r--r--src/common/Utilities/SFMTRand.h11
1 files changed, 4 insertions, 7 deletions
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 <SFMT.h>
#include <new>
@@ -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__