diff options
| author | 2016-11-03 17:38:22 +0100 | |
|---|---|---|
| committer | 2016-11-03 17:38:22 +0100 | |
| commit | a2732c6091e2220bf49de5b0b9b63777d6ab4d0f (patch) | |
| tree | 17b9828a298849cb8c385804a661de1bc240097c /die.cpp | |
| parent | 3469ef7a412d82c2ea8c341ea58aa9b3d8aba22e (diff) | |
| parent | 852259b33141281693efa8ccfec4d62affdaab82 (diff) | |
| download | OneRoll-a2732c6091e2220bf49de5b0b9b63777d6ab4d0f.tar.gz OneRoll-a2732c6091e2220bf49de5b0b9b63777d6ab4d0f.zip | |
Merge branch 'master' of github.com:Rolisteam/DiceParser
Diffstat (limited to 'die.cpp')
| -rw-r--r-- | die.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -29,11 +29,12 @@ Die::Die() : 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); +// uint seed = quintptr(this) + QDateTime::currentDateTime().toMSecsSinceEpoch(); + // qsrand(seed); + auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count(); + m_rng = std::mt19937(quintptr(this)+seed); } Die::Die(const Die& die) @@ -103,10 +104,9 @@ void Die::roll(bool adding) if(m_faces!=0) { //quint64 value=(qrand()%m_faces)+m_base; - 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(rng); + qint64 value = dist(m_rng); if((adding)||(m_rollResult.isEmpty())) { insertRollValue(value); |