From 442aec7ce198729e3c4811412a92df0215048320 Mon Sep 17 00:00:00 2001 From: Jyrki Vesterinen Date: Sun, 16 Oct 2016 20:37:25 +0300 Subject: [PATCH] Use boost::random_device for seeding the default RNG And use std::mt19937 as the RNG backend instead of boost::mt19937. --- src/random_new.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/random_new.cpp b/src/random_new.cpp index 8c47b5e679d..b97ee4a4457 100644 --- a/src/random_new.cpp +++ b/src/random_new.cpp @@ -18,8 +18,8 @@ #include #include -#include #include +#include static lg::log_domain log_random("random"); #define DBG_RND LOG_STREAM(debug, log_random) @@ -35,7 +35,10 @@ namespace { rng_default() : gen_() { - std::random_device entropy_source; + /* Note: do not replace this with std::random_device. + * @cbeck88 told in IRC (2016-10-16) that std::random_device + * is very poorly implemented in MinGW. */ + boost::random_device entropy_source; gen_.seed(entropy_source()); } protected: @@ -44,7 +47,7 @@ namespace { return gen_(); } private: - boost::mt19937 gen_; + std::mt19937 gen_; }; }