vendredi 27 août 2021

How to random between multiple strings in Kotlin?

I would like to write a code in Kotlin to random between "Rock", "Paper" and "Scissors". How to do it ?

I have tried something similar, that is random between H and T:

fun main() {
    val coin = "HT"
    println("My first coin flip is ${coin.random()}")
}



Aucun commentaire:

Enregistrer un commentaire