6 #include "core/Platform.h"
8 #define DEG2RAD 0.017453292519943
9 #define RAD2DEG 57.2957
18 return ((
float)rand())/RAND_MAX;
21 static float random(
float min,
float max)
23 return (min + ((max - min) * random()));
27 static void resetRandom(
unsigned int _seed = 0)
32 static float random(
bool fromSequence,
const char* log = NULL)
34 if (fromSequence && seed) {
35 seed = (8253729 * seed + 2396403);
36 float result = (float)(seed & RAND_MAX) / RAND_MAX;
37 LOGI(
"Math::random : (%s) result=%f", log, result);
44 static float random(
float min,
float max,
bool fromSequence)
46 return (min + ((max - min) * random(fromSequence)));
49 static glm::vec2 random2(
float minRadius,
float maxRadius,
bool fromSequence =
false)
55 result.x = random(-maxRadius, maxRadius, fromSequence);
56 result.y = random(-maxRadius, maxRadius, fromSequence);
58 radius = glm::length(result);
60 while (radius < minRadius && radius > maxRadius);
64 static const float PI;
67 static unsigned int seed;