Skip to content

//core/io.islandtime.ranges/randomOrNull

randomOrNull

common

fun DateRange.randomOrNull(): Date?

Returns a random date within this range using the default random number generator or null if the interval is empty or unbounded.

See also

random

common

fun DateRange.randomOrNull(random: Random): Date?

Returns a random date within this range using the supplied random number generator or null if the interval is empty or unbounded.

See also

random

common

fun DateTimeInterval.randomOrNull(): DateTime?

fun InstantInterval.randomOrNull(): Instant?

Returns a random date within this interval using the default random number generator or null if the interval is empty or unbounded.

See also

random

common

fun DateTimeInterval.randomOrNull(random: Random): DateTime?

fun InstantInterval.randomOrNull(random: Random): Instant?

Returns a random date within this interval using the supplied random number generator or null if the interval is empty or unbounded.

See also

random

common

fun OffsetDateTimeInterval.randomOrNull(): OffsetDateTime?

Returns a random date within this interval using the default random number generator or null if the interval is empty or unbounded. The offset of the start date-time will be used.

See also

random

common

fun OffsetDateTimeInterval.randomOrNull(random: Random): OffsetDateTime?

Returns a random date within this interval using the supplied random number generator or null if the interval is empty or unbounded. The offset of the start date-time will be used.

See also

random

common

fun ZonedDateTimeInterval.randomOrNull(): ZonedDateTime?

Returns a random date within this interval using the default random number generator or null if the interval is empty or unbounded. The zone of the start date-time will be used.

See also

random

common

fun ZonedDateTimeInterval.randomOrNull(random: Random): ZonedDateTime?

Returns a random date within this interval using the supplied random number generator or null if the interval is empty or unbounded. The zone of the start date-time will be used.

See also

random