kotlin random number
val randomNumber = (100..200).random()
random class in kotlin
import kotlin.random.Random
fun rand(start: Int, end: Int): Int {
require(start <= end) { "Illegal Argument" }
val rand = Random(System.nanoTime())
return (start..end).random(rand)
}
fun main() {
val start = 5
val end = 9
for (i in 1..5) println(rand(start, end))
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us