summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/heartrate-game/devicehandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bluetooth/heartrate-game/devicehandler.cpp')
-rw-r--r--examples/bluetooth/heartrate-game/devicehandler.cpp7
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..3d263a4c 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::global()->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::global()->bounded(5), 75);
} else { // Measuring
- randomValue = m_currentValue + qrand()%10 - 2;
+ randomValue = m_currentValue + QRandomGenerator::global()->bounded(10) - 2;
}
addMeasurement(randomValue);