diff options
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; } } |