common rng for random shuffle

This commit is contained in:
orignal 2024-02-14 21:35:41 -05:00
parent 56619caa71
commit dddbca6ffb
3 changed files with 10 additions and 7 deletions

View file

@ -15,6 +15,7 @@
#include <utility>
#include <mutex>
#include <memory>
#include <random>
#include "Identity.h"
#include "LeaseSet.h"
#include "RouterInfo.h"
@ -115,6 +116,8 @@ namespace tunnel
std::shared_ptr<const i2p::data::RouterInfo> SelectNextHop (std::shared_ptr<const i2p::data::RouterInfo> prevHop, bool reverse, bool endpoint) const;
bool StandardSelectPeers(Path & path, int numHops, bool inbound, SelectHopFunc nextHop);
std::mt19937& GetRng () { return m_Rng; }
private:
void TestTunnels ();
@ -148,6 +151,9 @@ namespace tunnel
uint64_t m_MinLatency = 0; // if > 0 this tunnel pool will try building tunnels with minimum latency by ms
uint64_t m_MaxLatency = 0; // if > 0 this tunnel pool will try building tunnels with maximum latency by ms
std::random_device m_Rd;
std::mt19937 m_Rng;
public:
// for HTTP only