mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
replace random_shuffle with shuffle
random_shuffle is gone with C++17. Found and fixed with clang-tidy.
This commit is contained in:
parent
6cc388c1bc
commit
eabcafa516
@ -1,5 +1,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "I2PEndian.h"
|
#include "I2PEndian.h"
|
||||||
|
#include <random>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -45,7 +46,7 @@ namespace tunnel
|
|||||||
// shuffle records
|
// shuffle records
|
||||||
std::vector<int> recordIndicies;
|
std::vector<int> recordIndicies;
|
||||||
for (int i = 0; i < numRecords; i++) recordIndicies.push_back(i);
|
for (int i = 0; i < numRecords; i++) recordIndicies.push_back(i);
|
||||||
std::random_shuffle (recordIndicies.begin(), recordIndicies.end());
|
std::shuffle (recordIndicies.begin(), recordIndicies.end(), std::mt19937(std::random_device()()));
|
||||||
|
|
||||||
// create real records
|
// create real records
|
||||||
uint8_t * records = msg->GetPayload () + 1;
|
uint8_t * records = msg->GetPayload () + 1;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <random>
|
||||||
#include "I2PEndian.h"
|
#include "I2PEndian.h"
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "Tunnel.h"
|
#include "Tunnel.h"
|
||||||
@ -441,7 +442,7 @@ namespace tunnel
|
|||||||
int size = m_ExplicitPeers->size ();
|
int size = m_ExplicitPeers->size ();
|
||||||
std::vector<int> peerIndicies;
|
std::vector<int> peerIndicies;
|
||||||
for (int i = 0; i < size; i++) peerIndicies.push_back(i);
|
for (int i = 0; i < size; i++) peerIndicies.push_back(i);
|
||||||
std::random_shuffle (peerIndicies.begin(), peerIndicies.end());
|
std::shuffle (peerIndicies.begin(), peerIndicies.end(), std::mt19937(std::random_device()()));
|
||||||
|
|
||||||
int numHops = isInbound ? m_NumInboundHops : m_NumOutboundHops;
|
int numHops = isInbound ? m_NumInboundHops : m_NumOutboundHops;
|
||||||
for (int i = 0; i < numHops; i++)
|
for (int i = 0; i < numHops; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user