diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-12 14:34:58 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-30 05:59:42 +0000 |
commit | 7761bb88000c19d2f5bfb1182f5c5ddf7dae6c5a (patch) | |
tree | 3aa56238a75adb55c768ab9abea81beee8f6138f /examples/bluetooth/heartrate-game | |
parent | 9ecd4d7bb7eb17babdb85762a197968f0f85a5e7 (diff) |
Use QRandomGenerator instead of q?rand
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'examples/bluetooth/heartrate-game')
-rw-r--r-- | examples/bluetooth/heartrate-game/devicehandler.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/bluetooth/heartrate-game/devicehandler.cpp b/examples/bluetooth/heartrate-game/devicehandler.cpp index dfc514b5..b9fe69c6 100644 --- a/examples/bluetooth/heartrate-game/devicehandler.cpp +++ b/examples/bluetooth/heartrate-game/devicehandler.cpp @@ -42,6 +42,7 @@ #include "devicehandler.h" #include "deviceinfo.h" #include <QtEndian> +#include <QRandomGenerator> DeviceHandler::DeviceHandler(QObject *parent) : BluetoothBaseClass(parent), @@ -248,11 +249,11 @@ void DeviceHandler::updateDemoHR() { int randomValue = 0; if (m_currentValue < 30) { // Initial value - randomValue = 55 + qrand()%30; + randomValue = 55 + QRandomGenerator::bounded(30); } else if (!m_measuring) { // Value when relax - randomValue = qBound(55, m_currentValue - 2 + qrand()%5, 75); + randomValue = qBound(55, m_currentValue - 2 + QRandomGenerator::bounded(5), 75); } else { // Measuring - randomValue = m_currentValue + qrand()%10 - 2; + randomValue = m_currentValue + QRandomGenerator::bounded(10) - 2; } addMeasurement(randomValue); |