Port away from deprecated q[s]rand() methods

This commit is contained in:
Volker Krause 2022-03-11 15:39:45 +01:00
parent c5a712a77a
commit 7188f8fbd1

View file

@ -18,6 +18,7 @@
#include <QTimer> #include <QTimer>
#include <QWindow> #include <QWindow>
#include <cmath> // for ceil() #include <cmath> // for ceil()
#include <cstdlib>
#include <KWaylandServer/surface_interface.h> #include <KWaylandServer/surface_interface.h>
#include <KWaylandServer/shadow_interface.h> #include <KWaylandServer/shadow_interface.h>
@ -665,7 +666,7 @@ void BlurEffect::generateNoiseTexture()
} }
// Init randomness based on time // Init randomness based on time
qsrand((uint)QTime::currentTime().msec()); std::srand((uint)QTime::currentTime().msec());
QImage noiseImage(QSize(256, 256), QImage::Format_Grayscale8); QImage noiseImage(QSize(256, 256), QImage::Format_Grayscale8);
@ -673,7 +674,7 @@ void BlurEffect::generateNoiseTexture()
uint8_t *noiseImageLine = (uint8_t *) noiseImage.scanLine(y); uint8_t *noiseImageLine = (uint8_t *) noiseImage.scanLine(y);
for (int x = 0; x < noiseImage.width(); x++) { for (int x = 0; x < noiseImage.width(); x++) {
noiseImageLine[x] = qrand() % m_noiseStrength; noiseImageLine[x] = std::rand() % m_noiseStrength;
} }
} }