This is My code
package com.example.application1
fun main() {
var storage = arrayOf(“This “,”Is “,”How “,”To “,”Create “,”Array “,”In “,”Kotlin “)
for (elements in storage){
print(elements)
}
println()
for (elements in storage) {
var len = storage.size-1
var i = (0..len).random()
print(storage[i])
}
}
I want to create something like if the random() function gives a certain number it won’t occur again in the loop so that every world of the Array is printed
Is there any way specificly for kotlin or do i have to create conditions
How can i achieve that?
Dreamer X is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.