Question : random string generator kotlin
Answered by : lars-artmann
private fun randomID(): String = List(16) { (('a'..'z') + ('A'..'Z') + ('0'..'9')).random()
}.joinToString("")
Source : https://stackoverflow.com/questions/41107/how-to-generate-a-random-alpha-numeric-string?page=2&tab=votes#tab-top | Last Update : Sat, 18 Jul 20
Question : Generate a random string in Kotlin
Answered by : hannan
fun getRandomString(length: Int) : String { val allowedChars = ('A'..'Z') + ('a'..'z') + ('0'..'9') return (1..length) .map { allowedChars.random() } .joinToString("")
}
Source : | Last Update : Sat, 13 Nov 21
Question : kotlin get random string
Answered by : dex-d5gsd80es9du
fun randomString(length: Int): String = List(length) { (32..126).random().toChar()
}.joinToString("")
Source : | Last Update : Sun, 06 Mar 22