title: How to generate random values from an array without repeating any in Objective-C
body: <p>Now that I have managed to display random texts on my button, I noticed how most of the times the items inside the array repeat itself. So I get something like "a b b b" or "a c b c" instead of "a b c d" or "a c d b". How do I tell my for loop to exclude the index of the array value that's already been used so it won't repeat any at all?</p>
  
  <p>Also, how do I tell the for loop to choose from certain values in the array instead of from everything so I won't have to make an array list for each question on the quiz? Like if I have [a b c d e f g] in my array, I want question 1 to display only [a b c e] in random order.</p>
  
  <p>Here's how my current code looks like:</p>
  
  <pre><code>answerList = [[NSMutableArray alloc] initWithObjects:
  "a", "b", "c", "d", "e", "f", "g", nil];
      for (int j=0; j&lt;answerList.count; j++)
  {
      int k = arc4random() % [answerList count];
      [btnA setTitle:[answerList objectAtIndex:k] forState:UIControlStateNormal];
      [answerList removeObjectAtIndex:k];
      int l = arc4random() % [answerList count];
      [btnB setTitle:[answerList objectAtIndex:l] forState:UIControlStateNormal];
      [answerList removeObjectAtIndex:l];
      int m = arc4random() % [answerList count];
      [btnC setTitle:[answerList objectAtIndex:m]  forState:UIControlStateNormal];
      [answerList removeObjectAtIndex:m];
      int n = arc4random() % [answerList count];
      [btnD setTitle:[answerList objectAtIndex:n] forState:UIControlStateNormal];
      [answerList removeObjectAtIndex:n]; }
  </code></pre>