r
Right?
s
you don’t need the index
for (number in array) { number = random() }
that’s more Kotliny
r
right?
i wanna do that but in a function
s
there’s zero reason to have a function to do that
what you’d want to do, is have loadArray take the n, and return an array, if you really want it to be a method
r
wait... i send my code
sorry if it's write in italian
s
yeah, take the first method that would take an array, and just have it return one
r
Thank you for your help, now my code work 😍
e
Copy code
fun loadArray(v: Array<Int>) {
    for ((index, value) in v.withIndex()) {
        v[index] = random()
    }
}