← Docs
kotlin-stdlib / kotlin.text / random

random

Common
JVM
JS
Native
1.3
fun CharSequence . random ( ) : Char
(source)

Returns a random character from this char sequence.

Exceptions

NoSuchElementException - if this char sequence is empty.

Common
JVM
JS
Native
1.3
fun CharSequence . random ( random : Random ) : Char
(source)

Returns a random character from this char sequence using the specified source of randomness.

Exceptions

NoSuchElementException - if this char sequence is empty.

Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Supported and developed by JetBrains .
Kotlin™ is protected under the Kotlin Foundation
and licensed under the Apache 2 license .