class RepeatStrategies {

    public static IntFunction<Completable> repeatWithExponentialBackoffAndJitter(final int maxRepeats,
                                                                                 final Duration initialDelay,
                                                                                 final Executor timerExecutor) {
        requireNonNull(timerExecutor);
        final long initialDelayNanos = initialDelay.toNanos();
        return repeatCount -> {
            if (repeatCount > maxRepeats) {
                return terminateRepeat();
            }
            return timerExecutor.timer(ThreadLocalRandom.current().nextLong(0, initialDelayNanos << (repeatCount - 1)),
                    NANOSECONDS);
        };
    }

    private  RepeatStrategies();

}