MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetExponentialRand

Function GetExponentialRand

src/random.cpp:715–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

713}
714
715std::chrono::microseconds GetExponentialRand(std::chrono::microseconds now, std::chrono::seconds average_interval)
716{
717 double unscaled = -std::log1p(GetRand(uint64_t{1} << 48) * -0.0000000000000035527136788 /* -1/2^48 */);
718 return now + std::chrono::duration_cast<std::chrono::microseconds>(unscaled * average_interval + 0.5us);
719}

Callers 5

NextInvToInboundsMethod · 0.85
MaybeSendAddrMethod · 0.85
MaybeSendFeefilterMethod · 0.85
SendMessagesMethod · 0.85
ThreadOpenConnectionsMethod · 0.85

Calls 1

GetRandFunction · 0.85

Tested by

no test coverage detected