Skip to main content

apply_jitter

Function apply_jitter 

Source
pub fn apply_jitter(
    cap: Duration,
    mode: JitterMode,
    rng: &mut dyn FnMut() -> u64,
) -> Duration
Expand description

Apply mode to a computed backoff cap.

Pure + seedable for tests: rng produces the next random u64 used to scale the cap when mode is JitterMode::Full. The result is always <= cap so the max_backoff invariant holds.