aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/randomsortmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquicklistview/randomsortmodel.cpp')
-rw-r--r--tests/auto/quick/qquicklistview/randomsortmodel.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/auto/quick/qquicklistview/randomsortmodel.cpp b/tests/auto/quick/qquicklistview/randomsortmodel.cpp
index 7affb182c0..7375fe0dbe 100644
--- a/tests/auto/quick/qquicklistview/randomsortmodel.cpp
+++ b/tests/auto/quick/qquicklistview/randomsortmodel.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include "randomsortmodel.h"
+#include <QRandomGenerator>
RandomSortModel::RandomSortModel(QObject* parent):
QAbstractListModel(parent)
@@ -73,14 +74,14 @@ QVariant RandomSortModel::data(const QModelIndex& index, int role) const
void RandomSortModel::randomize()
{
- const int row = qrand() % mData.count();
+ const int row = QRandomGenerator::global()->bounded(mData.count());
int random;
bool exists = false;
// Make sure we won't end up with two items with the same weight, as that
// would make unit-testing much harder
do {
exists = false;
- random = qrand() % (mData.count() * 10);
+ random = QRandomGenerator::global()->bounded(mData.count() * 10);
QList<QPair<QString, int> >::ConstIterator iter, end;
for (iter = mData.constBegin(), end = mData.constEnd(); iter != end; ++iter) {
if ((*iter).second == random) {