diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-12 16:01:04 -0700 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-07-04 11:46:00 +0000 |
commit | dbb55fba566fd3878b5ef76a2216f0c3f961147f (patch) | |
tree | 0c6f4a7a5cfb7dcfa41c88b205ddb155530b228d /examples/charts/qmloscilloscope | |
parent | 94f565a00cbc8d779251355cdb94704277711da7 (diff) |
Use QRandomGenerator instead of q?rand
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'examples/charts/qmloscilloscope')
-rw-r--r-- | examples/charts/qmloscilloscope/datasource.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/charts/qmloscilloscope/datasource.cpp b/examples/charts/qmloscilloscope/datasource.cpp index f687beb0..1f6c7272 100644 --- a/examples/charts/qmloscilloscope/datasource.cpp +++ b/examples/charts/qmloscilloscope/datasource.cpp @@ -33,6 +33,7 @@ #include <QtQuick/QQuickView> #include <QtQuick/QQuickItem> #include <QtCore/QDebug> +#include <QtCore/QRandomGenerator> #include <QtCore/QtMath> QT_CHARTS_USE_NAMESPACE @@ -82,7 +83,7 @@ void DataSource::generateData(int type, int rowCount, int colCount) switch (type) { case 0: // data with sin + random component - y = qSin(M_PI / 50 * j) + 0.5 + (qreal) rand() / (qreal) RAND_MAX; + y = qSin(M_PI / 50 * j) + 0.5 + QRandomGenerator::getReal(); x = j; break; case 1: |