Commit 8987f03c authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Port away from KRandom

parent 040bbafc
......@@ -40,7 +40,6 @@
#include <KLineEdit>
#include <KLocalizedString>
#include <KMessageBox>
#include <KRandom>
#include <KgTheme>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/Contacts/b2Contact.h>
......@@ -2147,7 +2146,7 @@ void KolfGame::lastHole()
void KolfGame::randHole()
{
int newHole = 1 + (int)((double)KRandom::random() * ((double)(highestHole - 1) / (double)RAND_MAX));
const int newHole = QRandomGenerator::global()->bounded(1, highestHole);
switchHole(newHole);
}
......
......@@ -24,12 +24,12 @@
#include <QFormLayout>
#include <QHBoxLayout>
#include <QRandomGenerator>
#include <QSlider>
#include <QSpinBox>
#include <QTimer>
#include <KConfigGroup>
#include <KPluralHandlingSpinBox>
#include <KRandom>
#include <KLocalizedString>
//BEGIN Kolf::BlackHole
......@@ -47,7 +47,7 @@ Kolf::BlackHole::BlackHole(QGraphicsItem* parent, b2World* world)
setZBehavior(CanvasItem::IsRaisedByStrut, 4);
setSimulationType(CanvasItem::NoSimulation);
const QColor myColor((QRgb)(KRandom::random() % 0x01000000));
const QColor myColor((QRgb)(QRandomGenerator::global()->bounded(0x01000000)));
ellipseItem()->setBrush(myColor);
m_exitItem->setPen(QPen(myColor, 6));
m_directionItem->setPen(myColor);
......
......@@ -25,11 +25,11 @@
#include <QCheckBox>
#include <QGridLayout>
#include <QLabel>
#include <QRandomGenerator>
#include <QSlider>
#include <QTimer>
#include <KConfigGroup>
#include <KLineEdit>
#include <KRandom>
#include <KLocalizedString>
//BEGIN Kolf::Bumper
......@@ -51,7 +51,7 @@ bool Kolf::Bumper::collision(Ball* ball)
Vector betweenVector(ball->pos() - pos());
betweenVector.setMagnitudeDirection(speed,
// add some randomness so we don't go indefinitely
betweenVector.direction() + deg2rad((KRandom::random() % 3) - 1)
betweenVector.direction() + deg2rad(QRandomGenerator::global()->bounded(3) - 1)
);
ball->setVelocity(betweenVector);
......
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