vendredi 29 mai 2020

How do I store an output of a function into an array in Kotlin

So for an assignment, I have to maker a program that generates 200 random numbers and then gets stored into the array and then called upon later. so I thought about storing the function in an array like this

    fun main() {
    var randomValues = arrayOf( List(200) { Random.nextInt(0, 100) })
    println(randomValues)
}

and that didn't work I get this output [Ljava.util.List;@533ddba. I'm not too accustomed to arrays so I'm not sure what to do. Sorry if this has been asked before.




Aucun commentaire:

Enregistrer un commentaire