I have an array of strings. And also I have variable that randomly chooses one string from it. The problem is – it can repeat values and I don't want that. Every value should be displayed only once. So how would I do that? I know that sets is more appropriate in this case than arrays, but it's more complicated for me
var questions = ["red", "blue", "green", "square", "tasty"]
let randomFact = Int(arc4random_uniform(UInt32(questions.count)))
For the purpose of my app it should display new value when button is touched. I tried to remove value from array to avoid it's repeating with
questions.removeAtIndex(Int(questions[randomFact])!)
But it crashes.
So how to display every value randomly but only once?