DEV Community

Discussion on: How do you do random?

Collapse
 
cout970 profile image
cout970

In kotlin

Random.nextInt(0..10)

Or

Random.nextInt(from = 0, until = 11)

Thanks to the Random api in the stdlib this works in the JVM, Kotlin.js and Kotlin native