mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
[move] Move PoissonNextSend to src/random and update comment
PoissonNextSend is used by net and net_processing and is stateless, so place it in the utility random.cpp translation unit.
This commit is contained in:
parent
801aaac2b3
commit
9e64d69bf7
4 changed files with 20 additions and 10 deletions
|
|
@ -3069,12 +3069,6 @@ std::chrono::microseconds CConnman::PoissonNextSendInbound(std::chrono::microsec
|
|||
return m_next_send_inv_to_incoming;
|
||||
}
|
||||
|
||||
std::chrono::microseconds PoissonNextSend(std::chrono::microseconds now, std::chrono::seconds average_interval)
|
||||
{
|
||||
double unscaled = -log1p(GetRand(1ULL << 48) * -0.0000000000000035527136788 /* -1/2^48 */);
|
||||
return now + std::chrono::duration_cast<std::chrono::microseconds>(unscaled * average_interval + 0.5us);
|
||||
}
|
||||
|
||||
CSipHasher CConnman::GetDeterministicRandomizer(uint64_t id) const
|
||||
{
|
||||
return CSipHasher(nSeed0, nSeed1).Write(id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue