(Kotlin)I Need HELP! How to Mod?


I’m trying to get random number and mod 2
Help me if you know how ㅠㅠ :cold_sweat:


Since your question isn’t very detailed, I’m not sure if this is what you are looking for, but here it is nevertheless:

import kotlin.random.Random
fun main()
    val randomNum = Random.nextInt()
    val isEven = randomNum % 2 == 0
    println("$randomNum isEven = '$isEven'")



Though in this case it might be better to use Random.nextBoolean().