diff options
Diffstat (limited to 'examples/corelib/threads/queuedcustomtype/renderthread.cpp')
-rw-r--r-- | examples/corelib/threads/queuedcustomtype/renderthread.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/corelib/threads/queuedcustomtype/renderthread.cpp b/examples/corelib/threads/queuedcustomtype/renderthread.cpp index f894dd587f..67cedf1e74 100644 --- a/examples/corelib/threads/queuedcustomtype/renderthread.cpp +++ b/examples/corelib/threads/queuedcustomtype/renderthread.cpp @@ -50,6 +50,8 @@ #include "renderthread.h" +#include <QRandomGenerator> + RenderThread::RenderThread(QObject *parent) : QThread(parent) { @@ -82,9 +84,9 @@ void RenderThread::run() for (int s = size; s > 0; --s) { for (int c = 0; c < 400; ++c) { //![processing the image (start)] - int x1 = qMax(0, (qrand() % m_image.width()) - s/2); + int x1 = qMax(0, QRandomGenerator::global()->bounded(m_image.width()) - s/2); int x2 = qMin(x1 + s/2 + 1, m_image.width()); - int y1 = qMax(0, (qrand() % m_image.height()) - s/2); + int y1 = qMax(0, QRandomGenerator::global()->bounded(m_image.height()) - s/2); int y2 = qMin(y1 + s/2 + 1, m_image.height()); int n = 0; int red = 0; |