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

common

DateRange.randomOrNull

Throws

kotlin.NoSuchElementException if the range is empty
kotlin.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

common

DateRange.randomOrNull

Throws

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

common

fun DateTimeInterval.random(): DateTime

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

See also

common

DateTimeInterval.randomOrNull

Throws

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

common

fun DateTimeInterval.random(random: Random): DateTime

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

See also

common

DateTimeInterval.randomOrNull

Throws

kotlin.NoSuchElementException if the interval is empty
kotlin.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

common

OffsetDateTimeInterval.randomOrNull

Throws

kotlin.NoSuchElementException if the interval is empty
kotlin.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

common

OffsetDateTimeInterval.randomOrNull

Throws

kotlin.NoSuchElementException if the interval is empty
kotlin.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

common

ZonedDateTimeInterval.randomOrNull

Throws

kotlin.NoSuchElementException if the interval is empty
kotlin.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

common

ZonedDateTimeInterval.randomOrNull

Throws

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

common

fun InstantInterval.random(): Instant

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

See also

common

InstantInterval.randomOrNull

Throws

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

common

fun InstantInterval.random(random: Random): Instant

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

See also

common

InstantInterval.randomOrNull

Throws

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