static int getRandomValueFromInterval(
            double randomizationFactor, double random, int currentIntervalMillis) {
        double delta = randomizationFactor * currentIntervalMillis;
        double minInterval = currentIntervalMillis - delta;
        double maxInterval = currentIntervalMillis + delta;
        // Get a random value from the range [minInterval, maxInterval].
        // The formula used below has a +1 because if the minInterval is 1 and the maxInterval is 3 then
        // we want a 33% chance for selecting either 1, 2 or 3.
        return (int) (minInterval + (random * (maxInterval - minInterval + 1)));
    }
@Test
    public void testGetRandomizedInterval() {
        // 33% chance of being 1.
        assertEquals(1, ExponentialBackOff.getRandomValueFromInterval(0.5, 0, 2));
        assertEquals(1, ExponentialBackOff.getRandomValueFromInterval(0.5, 0.33, 2));
        // 33% chance of being 2.
        assertEquals(2, ExponentialBackOff.getRandomValueFromInterval(0.5, 0.34, 2));
        assertEquals(2, ExponentialBackOff.getRandomValueFromInterval(0.5, 0.66, 2));
        // 33% chance of being 3.
        assertEquals(3, ExponentialBackOff.getRandomValueFromInterval(0.5, 0.67, 2));
        assertEquals(3, ExponentialBackOff.getRandomValueFromInterval(0.5, 0.99, 2));
    }