[Tizen] Add codes for Dali Windows Backend
[platform/core/uifw/dali-core.git] / dali / public-api / math / random.h
old mode 100644 (file)
new mode 100755 (executable)
index 2e8391e..bc6fcbd
@@ -2,7 +2,7 @@
 #define __DALI_RANDOM_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,6 +17,8 @@
  * limitations under the License.
  *
  */
+// EXTERNAL INCLUDES
+#include <ctime>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/math/vector4.h>
@@ -54,11 +56,13 @@ inline float Range(float f0, float f1)
   static bool initialized( false );
   if( !initialized )
   {
-    srand( time( NULL ) );
+    auto seed = time( NULL );
+    srand( seed );
     initialized = true;
   }
 
-  return min + (rand() & 0xfff) * (max-min) * (1.0f/4095.0f);
+  auto randValue = rand();
+  return (randValue & 0xfff) * (1.0f/4095.0f) * (max-min) + min;
 }
 
 /**