diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-12 15:28:13 -0700 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-08-23 04:47:59 +0000 |
commit | 2b7b24a0e039a18db8ab23475fbab44718f758a2 (patch) | |
tree | 0cfb916871a7e48d843dcd371d723a7d6083f2a6 /src/particles/qquickellipseextruder.cpp | |
parent | 46ed14da325c6c0382c0bc54cacc347d2d7f2b0a (diff) |
Use QRandomGenerator instead of q?rand
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/particles/qquickellipseextruder.cpp')
-rw-r--r-- | src/particles/qquickellipseextruder.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/particles/qquickellipseextruder.cpp b/src/particles/qquickellipseextruder.cpp index bd3a95d684..fbb11b34cc 100644 --- a/src/particles/qquickellipseextruder.cpp +++ b/src/particles/qquickellipseextruder.cpp @@ -39,7 +39,7 @@ #include "qquickellipseextruder_p.h" #include <qmath.h> -#include <stdlib.h> +#include <qrandom.h> QT_BEGIN_NAMESPACE /*! @@ -68,8 +68,8 @@ QQuickEllipseExtruder::QQuickEllipseExtruder(QObject *parent) : QPointF QQuickEllipseExtruder::extrude(const QRectF & r) { - qreal theta = ((qreal)rand()/RAND_MAX) * 6.2831853071795862; - qreal mag = m_fill ? ((qreal)rand()/RAND_MAX) : 1; + qreal theta = QRandomGenerator::bounded(2 * M_PI); + qreal mag = m_fill ? QRandomGenerator::getReal() : 1; return QPointF(r.x() + r.width()/2 + mag * (r.width()/2) * qCos(theta), r.y() + r.height()/2 + mag * (r.height()/2) * qSin(theta)); } |