How to generate 4 digits random numbers in Kotlin

1 Answer

0 votes
import kotlin.random.Random

fun main() {
    for (i in 0 until 20) {
        println(Random.nextInt(1000, 10000))
    }
}


 
 
/*
run:

7835
9445
6772
6806
9795
7743
3306
2296
8039
3044
5595
8664
5019
7559
8639
5446
2005
9141
7267
3339
 
*/

 



answered Dec 14, 2024 by avibootz
...