summaryrefslogtreecommitdiffstats
path: root/examples/charts/openglseries/datasource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/charts/openglseries/datasource.cpp')
-rw-r--r--examples/charts/openglseries/datasource.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/charts/openglseries/datasource.cpp b/examples/charts/openglseries/datasource.cpp
index 291bc722..1448e54e 100644
--- a/examples/charts/openglseries/datasource.cpp
+++ b/examples/charts/openglseries/datasource.cpp
@@ -29,6 +29,7 @@
#include "datasource.h"
#include <QtCore/QtMath>
+#include <QtCore/QRandomGenerator>
QT_CHARTS_USE_NAMESPACE
@@ -118,7 +119,7 @@ void DataSource::generateData(int seriesCount, int rowCount, int colCount)
qreal y(0);
// data with sin + random component
y = height + (yMultiplier * qSin(M_PI / 50 * j)
- + (yMultiplier * (qreal) rand() / (qreal) RAND_MAX));
+ + (yMultiplier * QRandomGenerator::getReal()));
// 0.000001 added to make values logaxis compatible
x = 0.000001 + 20.0 * (qreal(j) / qreal(colCount)) + (xAdjustment * qreal(i));
points.append(QPointF(x, y));