Skip to content

//core/io.islandtime.ranges/random

random

common

fun DateRange.random(): Date

Returns a random date within this range using the default random number generator.

See also

randomOrNull

Throws

NoSuchElementException if the range is empty
UnsupportedOperationException if the range is unbounded

common

fun DateRange.random(random: Random): Date

Returns a random date within this range using the supplied random number generator.

See also

randomOrNull

Throws

NoSuchElementException if the range is empty
UnsupportedOperationException if the range is unbounded

common

fun DateTimeInterval.random(): DateTime

fun InstantInterval.random(): Instant

Returns a random date within this interval using the default random number generator.

See also

randomOrNull

Throws

NoSuchElementException if the interval is empty
UnsupportedOperationException if the interval is unbounded

common

fun DateTimeInterval.random(random: Random): DateTime

fun InstantInterval.random(random: Random): Instant

Returns a random date within this interval using the supplied random number generator.

See also

randomOrNull

Throws

NoSuchElementException if the interval is empty
UnsupportedOperationException if the interval is unbounded

common

fun OffsetDateTimeInterval.random(): OffsetDateTime

Returns a random date within this interval using the default random number generator. The offset of the start date-time will be used.

See also

randomOrNull

Throws

NoSuchElementException if the interval is empty
UnsupportedOperationException if the interval is unbounded

common

fun OffsetDateTimeInterval.random(random: Random): OffsetDateTime

Returns a random date within this interval using the supplied random number generator. The offset of the start date-time will be used.

See also

randomOrNull

Throws

NoSuchElementException if the interval is empty
UnsupportedOperationException if the interval is unbounded

common

fun ZonedDateTimeInterval.random(): ZonedDateTime

Returns a random date within this interval using the default random number generator. The zone of the start date-time will be used.

See also

randomOrNull

Throws

NoSuchElementException if the interval is empty
UnsupportedOperationException if the interval is unbounded

common

fun ZonedDateTimeInterval.random(random: Random): ZonedDateTime

Returns a random date within this interval using the supplied random number generator. The zone of the start date-time will be used.

See also

randomOrNull

Throws

NoSuchElementException if the interval is empty
UnsupportedOperationException if the interval is unbounded