diff options
author | chai <chaifix@163.com> | 2018-11-19 21:20:32 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-19 21:20:32 +0800 |
commit | 22715652592b326feae3010a8bc80d6f8fadba50 (patch) | |
tree | 6c3a92254dde92b32a194ee757a6152c1ab00c7b /src/libjin/math/je_random.cpp | |
parent | b1b5adfcbed66691aa6d1775d20c6aec6d1a4696 (diff) |
*粒子系统
Diffstat (limited to 'src/libjin/math/je_random.cpp')
-rw-r--r-- | src/libjin/math/je_random.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libjin/math/je_random.cpp b/src/libjin/math/je_random.cpp index 216fd79..b9313d2 100644 --- a/src/libjin/math/je_random.cpp +++ b/src/libjin/math/je_random.cpp @@ -1,4 +1,5 @@ #include <math.h> +#include "je_math.h" #include "je_random.h" namespace JinEngine @@ -43,9 +44,10 @@ namespace JinEngine float RandomGenerator::randf(float min, float max, int ac) { + float floor = 0, ceil = max + reverse<float>(min); uint32 a = pow(10.f, ac); - uint32 n = rand(min*a, max*a); - return (float)n / a; + uint32 n = rand(floor*a, ceil*a); + return (float)n / a + min; } } |