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.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/charts/openglseries/datasource.cpp b/examples/charts/openglseries/datasource.cpp
index 5f554500..af2dc10e 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
@@ -111,8 +112,8 @@ void DataSource::generateData(int seriesCount, int rowCount, int colCount)
qreal x(0);
qreal y(0);
// data with sin + random component
- y = height + (yMultiplier * qSin(3.14159265358979 / 50 * j)
- + (yMultiplier * (qreal) rand() / (qreal) RAND_MAX));
+ y = height + (yMultiplier * qSin(M_PI / 50 * j)
+ + (yMultiplier * QRandomGenerator::global()->generateDouble()));
// 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));