Commit a0196872 authored by Albert Astals Cid's avatar Albert Astals Cid

Port away from KRandom

parent 3d19174d
......@@ -21,7 +21,7 @@
#include <cmath>
#include <KRandom>
#include <QRandomGenerator>
#include "board.h"
#include "renderer.h"
......@@ -110,7 +110,7 @@ void KBounceBall::setRandomFrame()
int frame = 1;
if ( m_framesNum > 1 )
{
frame = KRandom::random() % m_framesNum;
frame = QRandomGenerator::global()->bounded(m_framesNum);
}
setFrame( frame );
}
......
......@@ -18,11 +18,10 @@
#include "board.h"
#include <KRandom>
#include <QGraphicsScene>
#include <QTimer>
#include <QPainter>
#include <QRandomGenerator>
#include "ball.h"
#include "gameobject.h"
......@@ -127,10 +126,11 @@ void KBounceBoard::newLevel( int level )
}
foreach( KBounceBall* ball, m_balls )
{
ball->setRelativePos( 4 + KRandom::random() % ( TILE_NUM_W - 8 ),
4 + KRandom::random() % ( TILE_NUM_H - 8 ) );
ball->setVelocity( ((KRandom::random() & 1)*2-1)*m_ballVelocity,
((KRandom::random() & 1)*2-1)*m_ballVelocity );
ball->setRelativePos( 4 + QRandomGenerator::global()->bounded( TILE_NUM_W - 8 ),
4 + QRandomGenerator::global()->bounded( TILE_NUM_H - 8 ) );
ball->setVelocity( (QRandomGenerator::global()->bounded(2)*2-1)*m_ballVelocity,
(QRandomGenerator::global()->bounded(2)*2-1)*m_ballVelocity );
ball->setRandomFrame();
ball->show();
}
......
......@@ -25,8 +25,8 @@
#include "debug.h"
#include <QDir>
#include <QRandomGenerator>
#include <krandom.h>
#include <KgThemeProvider>
static KgThemeProvider* provider()
......@@ -116,7 +116,7 @@ QPixmap KBounceRenderer::getRandomBackgroundPixmap(const QString& path)
{
QString filename;
// return random pixmap
uint pos = KRandom::random() % dir.count();
const uint pos = QRandomGenerator::global()->bounded(dir.count());
if ( pos < dir.count() )
{
filename = dir.absoluteFilePath( dir[pos] );
......
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