We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 61e24f6 commit 51fa9b0Copy full SHA for 51fa9b0
1 file changed
src/helper.cpp
@@ -5,6 +5,7 @@
5
#include <engine/common.h>
6
#include <cmath>
7
#include <fstream>
8
+#include <random>
9
#ifdef EMSCRIPTEN
10
#include <emscripten.h>
11
#else
@@ -105,7 +106,10 @@ float LengthDir_y(float len, float dir) {
105
106
107
// Returns a random number between min and max
108
float RandomRange(float min, float max) {
- return min + (max - min) * (float)rand() / RAND_MAX;
109
+ static std::random_device rd;
110
+ static std::mt19937 gen(rd());
111
+ std::uniform_real_distribution<float> dis(min, max);
112
+ return dis(gen);
113
}
114
115
// Merges 2 colors
0 commit comments