mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
fix: replaced qrand() to QrandomGenerator due to deprecation
It fixes this and similar warnings: ``` qt/test/trafficgraphdatatests.cpp:145:23: warning: ‘int qrand()’ is deprecated: use QRandomGenerator instead [-Wdeprecated-declarations] 145 | int in = qrand() % 1000; | ~~~~~^~ ``` Call of `qsrand` is not needed because QRandomGenerator is already randomly initialized
This commit is contained in:
parent
f2e8431f4a
commit
0905bed3fb
@ -6,7 +6,7 @@
|
||||
#include <qt/trafficgraphdata.h>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <QTime>
|
||||
#include <QRandomGenerator>
|
||||
|
||||
void TrafficGraphDataTests::simpleCurrentSampleQueueTests()
|
||||
{
|
||||
@ -137,13 +137,12 @@ void compareQueues(const TrafficGraphData::SampleQueue& expected, const TrafficG
|
||||
|
||||
void testRangeSwitch(TrafficGraphData::GraphRange baseRange, TrafficGraphData::GraphRange toRange,int size)
|
||||
{
|
||||
QTime time = QTime::currentTime();
|
||||
qsrand((uint)time.msec());
|
||||
TrafficGraphData trafficGraphDataBase(baseRange);
|
||||
TrafficGraphData trafficGraphData(toRange);
|
||||
auto* generator = QRandomGenerator::global();
|
||||
for (int i = 1; i <= size; i++){
|
||||
int in = qrand() % 1000;
|
||||
int out = qrand() % 1000;
|
||||
int in = generator->generate() % 1000;
|
||||
int out = generator->generate() % 1000;
|
||||
trafficGraphData.update(TrafficSample(in, out));
|
||||
trafficGraphDataBase.update(TrafficSample(in, out));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user