diff options
| author | 2016-10-13 00:27:02 +0200 | |
|---|---|---|
| committer | 2016-10-13 00:27:02 +0200 | |
| commit | c3f5e98149b6ea6203887f6660ceae2bda0badd2 (patch) | |
| tree | 2e13a081ebfc314f5c5e43b08744817ccd534adb | |
| parent | 24b0acebcbb351e77bb11daf85b4bb3984a03ab8 (diff) | |
| download | OneRoll-c3f5e98149b6ea6203887f6660ceae2bda0badd2.tar.gz OneRoll-c3f5e98149b6ea6203887f6660ceae2bda0badd2.zip | |
-remove random_device because not all platform has random device.
| -rw-r--r-- | die.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -24,7 +24,7 @@ #include <QDateTime> #include <QDebug> - +#include <chrono> 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<qint64> dist(m_base,m_faces); - qint64 value = dist(rd); + qint64 value = dist(rng); if((adding)||(m_rollResult.isEmpty())) { insertRollValue(value); |