// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
export function exponentialBackoffWithJitter(cap, base, attempt, multiplier, jitter) {
  const exp = Math.min(cap, base * multiplier ** attempt);
  return (1 - jitter * Math.random()) * exp;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImh0dHBzOi8vZGVuby5sYW5kL3N0ZEAwLjIxNy4wL2FzeW5jL191dGlsLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIENvcHlyaWdodCAyMDE4LTIwMjQgdGhlIERlbm8gYXV0aG9ycy4gQWxsIHJpZ2h0cyByZXNlcnZlZC4gTUlUIGxpY2Vuc2UuXG4vLyBUaGlzIG1vZHVsZSBpcyBicm93c2VyIGNvbXBhdGlibGUuXG5cbmV4cG9ydCBmdW5jdGlvbiBleHBvbmVudGlhbEJhY2tvZmZXaXRoSml0dGVyKFxuICBjYXA6IG51bWJlcixcbiAgYmFzZTogbnVtYmVyLFxuICBhdHRlbXB0OiBudW1iZXIsXG4gIG11bHRpcGxpZXI6IG51bWJlcixcbiAgaml0dGVyOiBudW1iZXIsXG4pIHtcbiAgY29uc3QgZXhwID0gTWF0aC5taW4oY2FwLCBiYXNlICogbXVsdGlwbGllciAqKiBhdHRlbXB0KTtcbiAgcmV0dXJuICgxIC0gaml0dGVyICogTWF0aC5yYW5kb20oKSkgKiBleHA7XG59XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsMEVBQTBFO0FBQzFFLHFDQUFxQztBQUVyQyxPQUFPLFNBQVMsNkJBQ2QsR0FBVyxFQUNYLElBQVksRUFDWixPQUFlLEVBQ2YsVUFBa0IsRUFDbEIsTUFBYztFQUVkLE1BQU0sTUFBTSxLQUFLLEdBQUcsQ0FBQyxLQUFLLE9BQU8sY0FBYztFQUMvQyxPQUFPLENBQUMsSUFBSSxTQUFTLEtBQUssTUFBTSxFQUFFLElBQUk7QUFDeEMifQ==