Commit 78151490 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to QRandomGenerator

parent 89af8664
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <QShortcut> #include <QShortcut>
#include <QStatusBar> #include <QStatusBar>
#include <QWindowStateChangeEvent> #include <QWindowStateChangeEvent>
#include <QRandomGenerator>
// KDE // KDE
#include <KActionCollection> #include <KActionCollection>
...@@ -420,7 +421,7 @@ void KMahjongg::startNewGame(int item) ...@@ -420,7 +421,7 @@ void KMahjongg::startNewGame(int item)
availableLayouts.append(dir + '/' + file); availableLayouts.append(dir + '/' + file);
} }
} }
const QString layout = availableLayouts.at(qrand() % availableLayouts.size()); const QString layout = availableLayouts.at(QRandomGenerator::global()->bounded(availableLayouts.size()));
if (m_boardLayout->path() != layout) { if (m_boardLayout->path() != layout) {
// Try to load the random layout. // Try to load the random layout.
......
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