Init mersennetwister with current time.

This commit is contained in:
Faerbit 2020-06-07 11:33:54 +02:00
parent eaf035cdee
commit 98a6c551c3

3
util.h
View File

@ -3,6 +3,7 @@
#include <limits> #include <limits>
#include <random> #include <random>
#include <ctime>
const double infinity = std::numeric_limits<double>::infinity(); const double infinity = std::numeric_limits<double>::infinity();
const double pi = 3.1415926535897932385; const double pi = 3.1415926535897932385;
@ -13,7 +14,7 @@ inline double degrees_to_radians(double degrees) {
inline double random_double() { inline double random_double() {
static std::uniform_real_distribution<double> distribution(0.0, 1.0); static std::uniform_real_distribution<double> distribution(0.0, 1.0);
static std::mt19937 generator; static std::mt19937 generator(std::time(nullptr));
return distribution(generator); return distribution(generator);
} }