From e2b3304e40c99a91762d27a441ac8fcef4834a3d Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Fri, 22 Apr 2011 14:19:42 -0700 Subject: Fix rsRand(float, float) Change-Id: I553d83e1e962ad34aacbe6572d47ff25c3d50060 --- libs/rs/driver/rsdRuntimeMath.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libs/rs') diff --git a/libs/rs/driver/rsdRuntimeMath.cpp b/libs/rs/driver/rsdRuntimeMath.cpp index bd1fd0e..093e311 100644 --- a/libs/rs/driver/rsdRuntimeMath.cpp +++ b/libs/rs/driver/rsdRuntimeMath.cpp @@ -243,13 +243,15 @@ static void SC_MatrixTranspose_2x2(Matrix2x2 *m) { static float SC_randf(float max) { float r = (float)rand(); r *= max; - return r / RAND_MAX; + r /= RAND_MAX; + return r; } static float SC_randf2(float min, float max) { float r = (float)rand(); + r /= RAND_MAX; r = r * (max - min) + min; - return r / RAND_MAX; + return r; } static int SC_randi(int max) { -- cgit v1.1