File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ SOURCES += \
4343 qstroke.cpp \
4444 quantiles.cpp \
4545 state.cpp \
46- statistics.cpp \
4746 uncertain.cpp \
4847 upoint.cpp \
4948 usegment.cpp \
Original file line number Diff line number Diff line change 33
44#include < cassert>
55#include < cstdlib>
6+ #include < random>
67
78#include " statistics/prob.h"
89
@@ -65,7 +66,11 @@ inline double ContinuousUniform::pdf( const double x) const
6566// ! uniformly distributed random number in [a,b], b>a
6667inline double ContinuousUniform::rnd () const
6768{
68- const double u = static_cast <double >(rand ()) / static_cast <double >(RAND_MAX);
69+ // const double u = static_cast<double>(rand()) / static_cast<double>(RAND_MAX);
70+ static thread_local std::mt19937 engine{ std::random_device{} () };
71+ static thread_local std::uniform_real_distribution<double > dist (0.0 , 1.0 );
72+ const double u = dist (engine);
73+
6974 return a +u*(b -a);
7075}
7176
You can’t perform that action at this time.
0 commit comments