summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-06-12 15:33:12 -0700
committerThiago Macieira <thiago.macieira@intel.com>2017-06-30 14:53:58 +0000
commit420139a36dace3bb8f78f2d65b30f7657668d888 (patch)
treee40f613627f73ee8aa8d61f062c0741f86897b55 /tests
parent7bd7815f613c6f1ae0215d0b6a0ab5b7a6e72a59 (diff)
downloadqtlocation-420139a36dace3bb8f78f2d65b30f7657668d888.tar.gz
Use QRandomGenerator instead of q?rand
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp
index e0004596..e4bb755d 100644
--- a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp
+++ b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp
@@ -41,8 +41,6 @@ QDeclarativeLocationTestModel::QDeclarativeLocationTestModel(QObject *parent):
crazyLevel_(0),
crazyMode_(false)
{
- // seed crazy random generator
- qsrand(QTime(0,0,0).secsTo(QTime::currentTime()) + QCoreApplication::applicationPid());
timer_.setSingleShot(true);
connect(&timer_, SIGNAL(timeout()), this, SLOT(timerFired()));
}
@@ -63,7 +61,7 @@ void QDeclarativeLocationTestModel::timerFired()
repopulate();
if (crazyMode_) {
//qDebug() << "raw randomw value: " << qrand();
- int delay = (qAbs(qrand()) % crazyLevel_); // writing software is exact science
+ int delay = (QRandomGenerator::bounded(uint(INT_MAX) + 1) % crazyLevel_); // writing software is exact science
delay = qMax(1000, delay); // 3 ms at minimum
qDebug() << "starting timer with : " << delay;
timer_.start(delay);
@@ -164,7 +162,7 @@ void QDeclarativeLocationTestModel::repopulate()
}
int datacount = datacount_;
if (crazyMode_)
- datacount = (qAbs(qrand()) % datacount_);
+ datacount = QRandomGenerator::bounded(datacount_);
for (int i = 0; i < datacount; ++i) {
DataObject* dataobject = new DataObject;
@@ -206,7 +204,7 @@ void QDeclarativeLocationTestModel::scheduleRepopulation()
if (crazyMode_) {
// start generating arbitrary amount of data at arbitrary intervals
- int delay = (qAbs(qrand()) % crazyLevel_); // writing software is exact science
+ int delay = QRandomGenerator::bounded(crazyLevel_); // writing software is exact science
delay = qMax(3, delay); // 3 ms at minimum
qDebug() << "starting timer with : " << delay;
timer_.start(delay);