From 7761bb88000c19d2f5bfb1182f5c5ddf7dae6c5a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 12 Jun 2017 14:34:58 -0700 Subject: Use QRandomGenerator instead of q?rand Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Lars Knoll --- examples/bluetooth/heartrate-game/devicehandler.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'examples/bluetooth/heartrate-game/devicehandler.cpp') 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 +#include 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); -- cgit v1.2.3