X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fmath%2Frandom.h;h=394b2dd03240efbd4c2b221d833c929b3e69e84d;hb=c444a25e384fc570529b903478b4cb7404656988;hp=5ba0c95eba8ea049b3b50ea9fbbb11d6b435abab;hpb=e642efc6f1be0fa22a3c88b9947006112cc09027;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/math/random.h b/dali/public-api/math/random.h index 5ba0c95..394b2dd 100644 --- a/dali/public-api/math/random.h +++ b/dali/public-api/math/random.h @@ -35,6 +35,11 @@ namespace Dali namespace Random { +namespace +{ + __thread unsigned int seed; +} + /** * @brief Returns a random number between f0 and f1. * @@ -46,9 +51,10 @@ namespace Random */ inline float Range(float f0, float f1) { + seed = time(NULL); float min = std::min(f0, f1); float max = std::max(f0, f1); - return min + (rand() & 0xfff) * (max-min) * (1.0f/4095.0f); + return min + (rand_r(&seed) & 0xfff) * (max-min) * (1.0f/4095.0f); } /**