This commit is contained in:
Chris Marsh
2017-07-25 09:27:48 -07:00
parent 866e6d1104
commit 7a6172a300
10 changed files with 176 additions and 78 deletions

View File

@ -4,8 +4,7 @@
#include <algorithm>
#include <random>
struct Backoff
{
struct Backoff {
int64_t minAmount;
int64_t maxAmount;
int64_t current;
@ -13,16 +12,15 @@ struct Backoff
std::mt19937_64 randGenerator;
std::uniform_real_distribution<> randDistribution;
double rand01() {
return randDistribution(randGenerator);
}
double rand01() { return randDistribution(randGenerator); }
Backoff(int64_t min, int64_t max)
: minAmount(min)
, maxAmount(max)
, current(min)
, fails(0)
{}
: minAmount(min)
, maxAmount(max)
, current(min)
, fails(0)
{
}
void reset()
{
@ -38,4 +36,3 @@ struct Backoff
return current;
}
};