fullJitter function
FullJitter returns a random number, uniformly chosen from the range min, boundedDur
.
boundedDur is the duration bounded between min and max.
Implementation
Duration fullJitter(Duration duration, Duration min, Duration max, Random rng) {
if (duration <= min) {
return min;
}
final normalizedDur = boundedDuration(duration, min, max) - min;
return boundedDuration(
Duration(microseconds: rng.nextInt(normalizedDur.inMicroseconds)) + min,
min,
max
);
}