Commit 361f7ac9 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port away from KRandomSequence

parent b7f74067
Pipeline #208573 passed with stage
in 2 minutes and 51 seconds
......@@ -43,6 +43,7 @@ Game::Game (Kubrick * parent)
smMoveSlice (0),
smMoveDirection (CLOCKWISE),
random(QDateTime::currentMSecsSinceEpoch()),
cubeAligned (true),
moveIndex (-1)
{
......@@ -53,8 +54,6 @@ Game::Game (Kubrick * parent)
smInitInput(); // Initialise the move-text parsing.
random.setSeed (0); // Zero gets us an arbitrary seed.
setDefaults (); // Set all options to default values.
restoreState (); // Restore the last cube and its state.
demoPhase = false; // No demo yet.
......@@ -1201,7 +1200,7 @@ void Game::startDemo ()
void Game::randomDemo ()
{
double pickShape = random.getDouble ();
double pickShape = random.generateDouble();
// Pick cubes 40% of the time.
cubeSize [X] = pickANumber (2, 6);
......@@ -1631,7 +1630,7 @@ void Game::handleMouseEvent (MouseEvent event, int button, int mX, int mY)
int Game::pickANumber (int lo, int hi)
{
// Pick an integer in the range (lo..hi).
return (lo + (int) random.getLong (hi - lo + 1));
return random.bounded(lo, hi + 1);
}
......
......@@ -25,13 +25,13 @@
// KDE includes
#include <KStandardGameAction> // Used only to get internal names of actions.
#include <KRandomSequence>
// Qt includes
#include <QObject>
#include <QString>
#include <QList>
#include <QElapsedTimer>
#include <QRandomGenerator>
// Local includes.
#include "kubrick.h"
......@@ -192,7 +192,7 @@ private:
Kubrick * mainWindow; // Main window: used for status, etc.
GameGLView * gameGLView; // OpenGL view: used to draw 3D cubes.
KRandomSequence random; // Random number generator object.
QRandomGenerator random; // Random number generator object.
Cube * cube; // The cube that is in play.
float cubieSize; // Size of each cubie in OpenGL co-ordinates.
QList<CubeView *> cubeViews; // Parameters for views of 1-3 cubes.
......
Supports Markdown
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