core / io.islandtime.ranges / random

random

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun DateRange.random(): Date

Return a random date within the range using the default random number generator.

Exceptions

NoSuchElementException - if the range is empty

UnsupportedOperationException - if the range is unbounded

See Also

DateRange.randomOrNull

(iosArm64, iosX64, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun DateRange.random(random: <ERROR CLASS>): Date

Return a random date within the range using the supplied random number generator.

Exceptions

NoSuchElementException - if the range is empty

UnsupportedOperationException - if the range is unbounded

See Also

DateRange.randomOrNull

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun DateTimeInterval.random(): DateTime

Return a random date-time within the interval using the default random number generator.

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

DateTimeInterval.randomOrNull

(iosArm64, iosX64, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun DateTimeInterval.random(random: <ERROR CLASS>): DateTime

Return a random date-time within the interval using the supplied random number generator.

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

DateTimeInterval.randomOrNull

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun InstantInterval.random(): Instant

Return a random instant within the interval using the default random number generator.

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

InstantInterval.randomOrNull

(iosArm64, iosX64, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun InstantInterval.random(random: <ERROR CLASS>): Instant

Return a random instant within the interval using the supplied random number generator.

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

InstantInterval.randomOrNull

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun OffsetDateTimeInterval.random(): OffsetDateTime

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

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

OffsetDateTimeInterval.randomOrNull

(iosArm64, iosX64, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun OffsetDateTimeInterval.random(random: <ERROR CLASS>): OffsetDateTime

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

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

OffsetDateTimeInterval.randomOrNull

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun ZonedDateTimeInterval.random(): ZonedDateTime

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

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

ZonedDateTimeInterval.randomOrNull

(iosArm64, iosX64, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun ZonedDateTimeInterval.random(random: <ERROR CLASS>): ZonedDateTime

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

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

ZonedDateTimeInterval.randomOrNull

(jvm) fun DateRange.random(random: Random): Date

Return a random date within the range using the supplied random number generator.

Exceptions

NoSuchElementException - if the range is empty

UnsupportedOperationException - if the range is unbounded

See Also

DateRange.randomOrNull

(jvm) fun DateTimeInterval.random(random: Random): DateTime

Return a random date-time within the interval using the supplied random number generator.

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

DateTimeInterval.randomOrNull

(jvm) fun InstantInterval.random(random: Random): Instant

Return a random instant within the interval using the supplied random number generator.

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

InstantInterval.randomOrNull

(jvm) fun OffsetDateTimeInterval.random(random: Random): OffsetDateTime

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

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

OffsetDateTimeInterval.randomOrNull

(jvm) fun ZonedDateTimeInterval.random(random: Random): ZonedDateTime

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

Exceptions

NoSuchElementException - if the interval is empty

UnsupportedOperationException - if the interval is unbounded

See Also

ZonedDateTimeInterval.randomOrNull