diff options
author | Mattes D <github@xoft.cz> | 2014-12-07 15:46:27 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-12-07 15:46:27 +0100 |
commit | 3c3cb198f33fd55b9cb20188cc42034b21660d21 (patch) | |
tree | 282d86969d4a2cbad5a64a27d1e17a5bad8dbed6 /src/FastRandom.h | |
parent | Merge pull request #1555 from mc-server/c++11 (diff) | |
download | cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar.gz cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar.bz2 cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar.lz cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar.xz cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar.zst cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.zip |
Diffstat (limited to '')
-rw-r--r-- | src/FastRandom.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/FastRandom.h b/src/FastRandom.h index 7eecc698a..64a087c97 100644 --- a/src/FastRandom.h +++ b/src/FastRandom.h @@ -34,16 +34,16 @@ public: cFastRandom(void); - /// Returns a random int in the range [0 .. a_Range - 1]; a_Range must be less than 1M + /** Returns a random int in the range [0 .. a_Range - 1]; a_Range must be less than 1M */ int NextInt(int a_Range); - /// Returns a random int in the range [0 .. a_Range - 1]; a_Range must be less than 1M; a_Salt is additional source of randomness + /** Returns a random int in the range [0 .. a_Range - 1]; a_Range must be less than 1M; a_Salt is additional source of randomness */ int NextInt(int a_Range, int a_Salt); - /// Returns a random float in the range [0 .. a_Range]; a_Range must be less than 1M + /** Returns a random float in the range [0 .. a_Range]; a_Range must be less than 1M */ float NextFloat(float a_Range); - /// Returns a random float in the range [0 .. a_Range]; a_Range must be less than 1M; a_Salt is additional source of randomness + /** Returns a random float in the range [0 .. a_Range]; a_Range must be less than 1M; a_Salt is additional source of randomness */ float NextFloat(float a_Range, int a_Salt); /** Returns a random float between 0 and 1. */ @@ -55,8 +55,6 @@ public: private: std::minstd_rand m_LinearRand; - std::uniform_int_distribution<> m_IntDistribution; - std::uniform_real_distribution<float> m_FloatDistribution; }; @@ -69,15 +67,20 @@ public: MTRand(void); + /** Returns a random integer in the range [0 .. a_Range]. */ int randInt(int a_Range); + /** Returns a random integer in the range [0 .. MAX_INT]. */ int randInt(void); + /** Returns a random floating point number in the range [0 .. a_Range]. */ double rand(double a_Range); private: std::mt19937 m_MersenneRand; - std::uniform_int_distribution<> m_IntDistribution; - std::uniform_real_distribution<> m_DoubleDistribution; }; + + + + |