diff options
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 ec83586b..ab203c3f 100644 --- a/examples/bluetooth/heartrate-game/devicehandler.cpp +++ b/examples/bluetooth/heartrate-game/devicehandler.cpp @@ -52,6 +52,7 @@ #include "devicehandler.h" #include "deviceinfo.h" #include <QtEndian> +#include <QRandomGenerator> DeviceHandler::DeviceHandler(QObject *parent) : BluetoothBaseClass(parent), @@ -258,11 +259,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); |