aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/die.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'die.cpp')
-rw-r--r--die.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/die.cpp b/die.cpp
index 1c52adb..864ed27 100644
--- a/die.cpp
+++ b/die.cpp
@@ -25,13 +25,16 @@
#include <QDateTime>
#include <QDebug>
+
Die::Die()
- : m_hasValue(false),m_displayStatus(false),m_highlighted(true),m_base(1),m_color("")
+ : m_hasValue(false),m_displayStatus(false),m_highlighted(true),m_base(1),m_color("")//,m_mt(m_randomDevice)
{
uint seed = quintptr(this) + QDateTime::currentDateTime().toMSecsSinceEpoch();
+
qsrand(seed);
+
}
Die::Die(const Die& die)
{
@@ -99,7 +102,10 @@ void Die::roll(bool adding)
{
if(m_faces!=0)
{
- quint64 value=(qrand()%m_faces)+m_base;
+ //quint64 value=(qrand()%m_faces)+m_base;
+ std::random_device rd;
+ std::uniform_int_distribution<qint64> dist(m_base,m_faces);
+ qint64 value = dist(rd);
if((adding)||(m_rollResult.isEmpty()))
{
insertRollValue(value);