diff options
author | chai <chaifix@163.com> | 2018-11-18 23:44:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-18 23:44:40 +0800 |
commit | 8cb74178c2b8e5883a1181af687fa8cfc0c6e5da (patch) | |
tree | f56c536a029148df35bd4e82034a9b563a2381df /src/libjin/Math/je_random.cpp | |
parent | f0f340dec7821cee103ab9267ef941a917ef4dc4 (diff) |
*修改目录为小写
Diffstat (limited to 'src/libjin/Math/je_random.cpp')
-rw-r--r-- | src/libjin/Math/je_random.cpp | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/libjin/Math/je_random.cpp b/src/libjin/Math/je_random.cpp deleted file mode 100644 index 216fd79..0000000 --- a/src/libjin/Math/je_random.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include <math.h> -#include "je_random.h" - -namespace JinEngine -{ - namespace Math - { - - RandomGenerator::RandomGenerator(uint32 seed) - : mSeed(seed) - { - } - - uint32 RandomGenerator::rand() - { - unsigned int next = mSeed; - uint32 result; - - next *= 1103515245; - next += 12345; - result = (unsigned int)(next / 65536) % 2048; - - next *= 1103515245; - next += 12345; - result <<= 10; - result ^= (unsigned int)(next / 65536) % 1024; - - next *= 1103515245; - next += 12345; - result <<= 10; - result ^= (unsigned int)(next / 65536) % 1024; - - mSeed = next; - - return result; - } - - uint32 RandomGenerator::rand(uint32 min, uint32 max) - { - uint32 n = rand(); - return n % (max - min + 1) + min; - } - - float RandomGenerator::randf(float min, float max, int ac) - { - uint32 a = pow(10.f, ac); - uint32 n = rand(min*a, max*a); - return (float)n / a; - } - - } -}
\ No newline at end of file |