0

I am working on picker views and I am doing a trivia game. So I got an Array with different questions and another one with answers, this is what I have:

my code

So my question is: I need to do this but without repeating questions/answers, is there some solution?

I thought in doing two arrays, one for questions and another one with those questions but randomized, because when people answer I have to delete the question just so it doesn't repeat. But I don't know how to do it.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
ToniTJK
  • 181
  • 1
  • 3
  • 11
  • 2
    You can have a separate array that holds questions already asked. Then before you pick a question you can check to make sure it hasn’t already been asked. – Cory Sparks Nov 24 '17 at 15:36
  • See https://stackoverflow.com/questions/46382227/generate-random-strings-without-a-shuffle-and-repetition-of-previous-ones, https://stackoverflow.com/questions/45132047/randomly-select-5-elements-from-an-array-list-without-repeating-an-element, and of course https://stackoverflow.com/questions/24026510/how-do-i-shuffle-an-array-in-swift. – Martin R Nov 24 '17 at 15:38

0 Answers0