1 2 3 4 5 6 7 8 9 10 11 12 13 |
x12 x12 x12 x12 x12 x12 x138 x138 x138 |
// Copyright 2018-2025 the Deno authors. MIT license.
// This module is browser compatible.
export function exponentialBackoffWithJitter(
cap: number,
base: number,
attempt: number,
multiplier: number,
jitter: number,
) {
const exp = Math.min(cap, base * multiplier ** attempt);
return (1 - jitter * Math.random()) * exp;
}
|