title: How do I make my random index progress through a whole array?
body: <p>Currently my code spits out a random index from an array of keys and values. However the index stays the same and displays the same keys and values but what I want it to do is display one random index the iterate through the arrays and display another random index that is not equal to the previous random index. How could I implement this?</p>
  
  <p>Here is my code (swift for iOS):</p>
  
  <pre><code>class QuestionDetails {
       let QADictionary = ["Who is Thor's brother?" : ["Atum", "Loki", "Red Norvell", "Kevin Masterson"], "What is the name of Thor's hammer?" : ["Mjolinr", "Uru", "Stormbreaker", "Thundara"], "Who is the father of Thor?" : ["Odin", "Sif", "Heimdall", "Balder"]]  
  }
  
  //get question list
  func questionWithAnswers() {
       let listQuestions = QuestionDetails()
  
       //array of keys/questions
       var questionList = Array(listQuestions.QADictionary.keys)
  
       //random question index
       var rand = Int(arc4random_uniform(UInt32(questionList.count)))
       var randAnswers = rand
  
       //array of values/answers
       var answerList = Array(listQuestions.QADictionary.values)
  
       //button answer choices
       var choices = answerList[randAnswers]
  
       //fetch questions from list
       let question = questionList[rand]
  
       //function for new question and button titles
       questionLabel.text = question
       rightAnswerBox = arc4random_uniform(4)+1
  
       //create button
       var button:UIButton = UIButton()
       var x = 1
  
       for index in 1...4 {
           button = view.viewWithTag(index) as! UIButton
           if (index == Int(rightAnswerBox)) {
               button.setTitle(choices[0], for: .normal)
           } else {
               button.setTitle(choices[x], for: .normal)
               x += 1
           }
           randomImage()
       }
  }
  </code></pre>