diff --git a/src/helper.cpp b/src/helper.cpp index ab7e66b..ba3d090 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #ifdef EMSCRIPTEN #include #else @@ -105,7 +106,10 @@ float LengthDir_y(float len, float dir) { // Returns a random number between min and max float RandomRange(float min, float max) { - return min + (max - min) * (float)rand() / RAND_MAX; + static std::random_device rd; + static std::mt19937 gen(rd()); + std::uniform_real_distribution dis(min, max); + return dis(gen); } // Merges 2 colors