Answers for "random value apears onece kotlin android"

0

random value apears onece kotlin android

val unpickedNumbers = (0..75).toMutableSet()

nextnumberbutton.setOnClickListener {
    if (unpickedNumbers.isEmpty()) {
        Toast.makeText(context, "All numbers already picked", Toast.LENGTH_LONG).show()
        return
    }
    val rand = unpickedNumbers.random()
    numbertextview.text = rand.toString()
    unpickedNumbers.remove(rand)
}
Posted by: Guest on March-25-2022

Browse Popular Code Answers by Language