### Question:
Backoff { public static Stream<Long> equalJittered(long startMs, long maxMs) { final long startNanos = TimeUnit.NANOSECONDS.convert(startMs, TimeUnit.MILLISECONDS); final long maxNanos = TimeUnit.NANOSECONDS.convert(maxMs, TimeUnit.MILLISECONDS); final AtomicLong attempts = new AtomicLong(1); return Stream.iterate(startMs, lastMs -> { long shift = Math.min(attempts.get() - 1, MaxBitShift); long halfExpNanos = startNanos * (1L << shift); long backoffNanos = halfExpNanos + ThreadLocalRandom.current().nextLong(halfExpNanos); attempts.incrementAndGet(); if (backoffNanos < maxNanos) { return TimeUnit.MILLISECONDS.convert(backoffNanos, TimeUnit.NANOSECONDS); } else { return maxMs; } }); }  static Stream<Long> constant(long startMs); static Stream<Long> exponential(long startMs,
                                           int multiplier,
                                           long maxMs); static Stream<Long> exponentialJittered(long startMs,
                                                   long maxMs); static Stream<Long> decorrelatedJittered(long startMs,
                                                    long maxMs); static Stream<Long> equalJittered(long startMs,
                                             long maxMs); static final Policy DEFAULT; }### Answer:
@Test public void testEqualJittered() throws Exception { Stream<Long> backoffs = Backoff.equalJittered(5, 120).limit(10); Stream<Pair<Long, Long>> ranges = Stream.of( Pair.of(5L, 10L), Pair.of(10L, 20L), Pair.of(20L, 40L), Pair.of(40L, 80L), Pair.of(80L, 120L), Pair.of(80L, 120L), Pair.of(80L, 120L), Pair.of(80L, 120L), Pair.of(80L, 120L) ); StreamUtil.<Long, Pair<Long, Long>, Void>zip(backoffs, ranges, (backoff, maxPair) -> { assertTrue(backoff >= maxPair.getLeft()); assertTrue(backoff <= maxPair.getRight()); return null; }); }