Class DateUtilities

java.lang.Object
megamek.common.util.DateUtilities

public class DateUtilities extends Object
  • Constructor Details

    • DateUtilities

      public DateUtilities()
  • Method Details

    • getRandomDateBetween

      public static LocalDate getRandomDateBetween(LocalDate start, LocalDate end)
      Returns a random LocalDate between the given start (inclusive) and end (inclusive) dates.

      This method converts both start and end dates to their epoch day representations, selects a random day within that range, and constructs a LocalDate from the random epoch day.

      Parameters:
      start - the earliest date to select (inclusive)
      end - the latest date to select (inclusive)
      Returns:
      a randomly selected LocalDate between start and end, inclusive
      Throws:
      IllegalArgumentException - if start is after end