Skip to content
Snippets Groups Projects
Commit 5807628f authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

[m.i1010] Unify random number generators (Closes #1010)

Merging branch 'm.i1010'  into 'main'.

See merge request !2673
parents d9ae48c9 6e6f8d2c
No related branches found
No related tags found
1 merge request!2673Unify random number generators
Pipeline #151972 passed
......@@ -116,7 +116,7 @@ double Math::GenerateStandardNormalRandom() // using c++11 standard library
{
unsigned seed =
static_cast<unsigned>(std::chrono::system_clock::now().time_since_epoch().count());
std::default_random_engine generator(seed);
std::mt19937 generator(seed);
std::normal_distribution<double> distribution(0.0, 1.0);
return distribution(generator);
}
......@@ -131,7 +131,7 @@ double Math::GeneratePoissonRandom(double average) // using c++11 standard libra
{
unsigned seed =
static_cast<unsigned>(std::chrono::system_clock::now().time_since_epoch().count());
std::default_random_engine generator(seed);
std::mt19937 generator(seed);
if (average <= 0.0)
return 0.0;
if (average < 1000.0) { // Use std::poisson_distribution
......
......@@ -42,7 +42,7 @@ QColor suggestMaterialColor(const QString& name)
// return a random color
static std::random_device r;
std::default_random_engine re(r());
std::mt19937 re(r());
std::uniform_int_distribution<int> ru(0, 255);
return QColor(ru(re), ru(re), ru(re));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment