MCPcopy Create free account
hub / github.com/catboost/catboost / RandomizeSleepTime

Function RandomizeSleepTime

util/system/spin_wait.cpp:12–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11namespace {
12 unsigned RandomizeSleepTime(unsigned t) noexcept {
13 static std::atomic<unsigned> counter = 0;
14 const unsigned rndNum = IntHash(++counter);
15
16 return (t * 4 + (rndNum % t) * 2) / 5;
17 }
18
19 // arbitrary values
20 constexpr unsigned MIN_SLEEP_TIME = 500;

Callers 1

SleepMethod · 0.85

Calls 1

IntHashFunction · 0.85

Tested by

no test coverage detected