I want to get random alphabet without create list of all alphabets and get random index
I tried this
fun getChar(){
    val alphabets = ('a'..'z').toList()
    return alphabets[Random().nextInt(alphabets.size)]
}
I want to get random alphabet without create list of all alphabets and get random index
I tried this
fun getChar(){
    val alphabets = ('a'..'z').toList()
    return alphabets[Random().nextInt(alphabets.size)]
}
 
    
    You can use ASCII Character codes. generate a random number from 97 representing a, to 122 representing z, then use toChar(charCode) to get the corresponding letter.
also see: ASCII Table
ALSO as Madhu Bhat said in the comments you can use ('a'..'z').random() for a more precise way.
