Init mersennetwister with current time.
This commit is contained in:
parent
eaf035cdee
commit
98a6c551c3
3
util.h
3
util.h
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user