summaryrefslogtreecommitdiffstats
path: root/examples/charts/modeldata/customtablemodel.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-06-12 16:01:04 -0700
committerLars Knoll <lars.knoll@qt.io>2017-07-04 11:46:00 +0000
commitdbb55fba566fd3878b5ef76a2216f0c3f961147f (patch)
tree0c6f4a7a5cfb7dcfa41c88b205ddb155530b228d /examples/charts/modeldata/customtablemodel.cpp
parent94f565a00cbc8d779251355cdb94704277711da7 (diff)
Use QRandomGenerator instead of q?rand
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'examples/charts/modeldata/customtablemodel.cpp')
-rw-r--r--examples/charts/modeldata/customtablemodel.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/charts/modeldata/customtablemodel.cpp b/examples/charts/modeldata/customtablemodel.cpp
index 1bc607be..98cd8c8c 100644
--- a/examples/charts/modeldata/customtablemodel.cpp
+++ b/examples/charts/modeldata/customtablemodel.cpp
@@ -29,15 +29,13 @@
#include "customtablemodel.h"
#include <QtCore/QVector>
-#include <QtCore/QTime>
+#include <QtCore/QRandomGenerator>
#include <QtCore/QRect>
#include <QtGui/QColor>
CustomTableModel::CustomTableModel(QObject *parent) :
QAbstractTableModel(parent)
{
- qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
-
m_columnCount = 4;
m_rowCount = 15;
@@ -46,9 +44,9 @@ CustomTableModel::CustomTableModel(QObject *parent) :
QVector<qreal>* dataVec = new QVector<qreal>(m_columnCount);
for (int k = 0; k < dataVec->size(); k++) {
if (k % 2 == 0)
- dataVec->replace(k, i * 50 + qrand() % 20);
+ dataVec->replace(k, i * 50 + QRandomGenerator::bounded(20));
else
- dataVec->replace(k, qrand() % 100);
+ dataVec->replace(k, QRandomGenerator::bounded(100));
}
m_data.append(dataVec);
}