randomOrNull

Common
JVM
JS
Native
1.4
fun CharSequence.randomOrNull(): Char?
(source)

Returns a random character from this char sequence, or null if this char sequence is empty.

Common
JVM
JS
Native
1.4
fun CharSequence.randomOrNull(random: Random): Char?
(source)

Returns a random character from this char sequence using the specified source of randomness, or null if this char sequence is empty.