Commit 8fac53a4 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to QRandomGenerator

parent 93932ea1
......@@ -20,7 +20,7 @@
#include "fakeewsserver.h"
#include <QThread>
#include <QRandomGenerator>
#include "fakeewsconnection.h"
#include "fakeewsserver_debug.h"
......@@ -43,8 +43,9 @@ bool FakeEwsServer::start()
int retries = 3;
bool ok;
auto *generator = QRandomGenerator::global();
do {
mPortNumber = (qrand() % 10000) + 10000;
mPortNumber = (generator->bounded(10000)) + 10000;
qCInfoNC(EWSFAKE_LOG) << QStringLiteral("Starting fake EWS server at 127.0.0.1:%1").arg(mPortNumber);
ok = listen(QHostAddress::LocalHost, mPortNumber);
if (!ok) {
......
......@@ -37,7 +37,6 @@ IsolatedTestBase::IsolatedTestBase(QObject *parent)
: QObject(parent)
, mFakeServerThread(new FakeEwsServerThread(this))
{
qsrand(QDateTime::currentDateTimeUtc().toMSecsSinceEpoch());
}
IsolatedTestBase::~IsolatedTestBase()
......
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