Commit 6822ab7a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port KRandom::random

parent 6517c641
......@@ -24,9 +24,8 @@
#include <QGraphicsView>
#include <QStandardPaths>
#include <QTimer>
#include <QRandomGenerator>
// KDE
#include <KRandom>
// Bomber
#include "bomb.h"
......@@ -143,7 +142,7 @@ void BomberBoard::newLevel(unsigned int level)
if (max < 5) {
max = 5;
}
unsigned int height = (KRandom::random() % (max - min)) + min;
unsigned int height = QRandomGenerator::global()->bounded(max - min) + min;
m_buildingBlocks += height;
auto building = new Building(m_renderer, this, i + 1, height);
......
......@@ -21,8 +21,7 @@
// KDE
#include <KGameRenderedItem>
#include <KRandom>
#include <QRandomGenerator>
// Bomber
#include "board.h"
......@@ -87,11 +86,11 @@ void Building::setupBuildingTiles()
++styleCount;
}
}
unsigned int style = KRandom::random() % styleCount;
unsigned int style = QRandomGenerator::global()->bounded(styleCount);
unsigned int maxVarient = m_renderer->frameCount(QStringLiteral("building_%1").arg(style));
for (unsigned int heightIndex = 0; heightIndex < m_height - 1; ++heightIndex) {
unsigned int varient = KRandom::random() % (maxVarient);
unsigned int varient = QRandomGenerator::global()->bounded(maxVarient);
const QString pixmap = QStringLiteral("building_%1_%2").arg(style).arg(varient);
m_buildingTiles.append(createBuildingTile(pixmap));
}
......
......@@ -91,7 +91,7 @@ void Explodable::setVelocity(qreal vX)
void Explodable::setRandomFrame()
{
setFrame(KRandom::random());
setFrame(QRandomGenerator::global()->generate());
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment