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 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);