diff options
Diffstat (limited to 'examples/opengl/legacy/overpainting/bubble.cpp')
-rw-r--r-- | examples/opengl/legacy/overpainting/bubble.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/opengl/legacy/overpainting/bubble.cpp b/examples/opengl/legacy/overpainting/bubble.cpp index afc50117d0..352e359cf9 100644 --- a/examples/opengl/legacy/overpainting/bubble.cpp +++ b/examples/opengl/legacy/overpainting/bubble.cpp @@ -50,6 +50,8 @@ #include "bubble.h" +#include <QRandomGenerator> + Bubble::Bubble(const QPointF &position, qreal radius, const QPointF &velocity) : position(position), vel(velocity), radius(radius) { @@ -80,10 +82,10 @@ void Bubble::drawBubble(QPainter *painter) QColor Bubble::randomColor() { - int red = int(205 + 50.0*qrand()/(RAND_MAX+1.0)); - int green = int(205 + 50.0*qrand()/(RAND_MAX+1.0)); - int blue = int(205 + 50.0*qrand()/(RAND_MAX+1.0)); - int alpha = int(91 + 100.0*qrand()/(RAND_MAX+1.0)); + int red = int(205 + QRandomGenerator::global()->bounded(50)); + int green = int(205 + QRandomGenerator::global()->bounded(50)); + int blue = int(205 + QRandomGenerator::global()->bounded(50)); + int alpha = int(91 + QRandomGenerator::global()->bounded(100)); return QColor(red, green, blue, alpha); } |