I have a quiz app that generates a random question. at the moment because of the randomization, you can sometimes answer the same question multiple times. I have an an array of questions and I use the arc4Random method to generate a random question on the screen.
how do I make it so that swift recognises that a question is already been on and to skip it? would I have to make an if statement? and if so how would I code that?
var currentQuestion = Int(arc4random_uniform(31) + 1)
var rightAnswerPlacement:UInt32 = 0
var seconds = 30
var timer = Timer()
var score = 0
if (sender.tag == Int(rightAnswerPlacement)) {
score += 1
scoreLabel.text = "\(score)"
seconds = 100
currentQuestion = Int(arc4random_uniform(32) + 1)
} else {
timer.invalidate()
end()
}