From c3f5e98149b6ea6203887f6660ceae2bda0badd2 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 13 Oct 2016 00:27:02 +0200 Subject: -remove random_device because not all platform has random device. --- die.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/die.cpp b/die.cpp index 864ed27..4dd61de 100644 --- a/die.cpp +++ b/die.cpp @@ -24,7 +24,7 @@ #include #include - +#include Die::Die() : m_hasValue(false),m_displayStatus(false),m_highlighted(true),m_base(1),m_color("")//,m_mt(m_randomDevice) @@ -103,9 +103,10 @@ void Die::roll(bool adding) if(m_faces!=0) { //quint64 value=(qrand()%m_faces)+m_base; - std::random_device rd; + auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count(); + std::mt19937 rng(quintptr(this)+seed); std::uniform_int_distribution dist(m_base,m_faces); - qint64 value = dist(rd); + qint64 value = dist(rng); if((adding)||(m_rollResult.isEmpty())) { insertRollValue(value); -- cgit v1.2.3-70-g09d2