Class RandomDuration

java.lang.Object
io.camunda.zeebe.broker.system.partitions.impl.RandomDuration

public final class RandomDuration extends Object
  • Method Details

    • getRandomDurationMinuteBased

      public static Duration getRandomDurationMinuteBased(Duration minDuration, Duration maxDuration)
      Returns a pseudo-random duration between the given minimum and maximum duration.

      If the max duration is smaller or equals to the minimum duration, then the minimum duration is returned. This ensure to always have a base line or lower limit.

      The random duration is minute based, so if the given duration differ only in seconds then the minimum duration is returned

      Parameters:
      minDuration - the minimum duration, inclusive
      maxDuration - the maximum duration, exclusive
      Returns:
      a pseudo-random duration between the minimum and maximum duration