random

inline fun IntRange.random(): Int(source)
inline fun LongRange.random(): Long(source)
inline fun CharRange.random(): Char(source)

Returns a random element from this range.

Since Kotlin

1.3

Throws

if this range is empty.


Returns a random element from this range using the specified source of randomness.

Since Kotlin

1.3

Throws

if this range is empty.


inline fun UIntRange.random(): UInt(source)
inline fun ULongRange.random(): ULong(source)

Returns a random element from this range.

Since Kotlin

1.5

Throws

if this range is empty.


Returns a random element from this range using the specified source of randomness.

Since Kotlin

1.5

Throws

if this range is empty.