title: Avoid repeating questions for different categories in Quiz App
body: <p>In this quiz app I would like to avoid repeating questions. There are ten categories with 17 questions each. I tried to use an array where the selected question number is stored.</p>
  
  <p>How can I have <code>QuestionSelected</code> be a number that has not previously been stored in the array? Right now it does not work..</p>
  
  <pre><code>CategoryLoaded = [[NSUserDefaults standardUserDefaults] integerForKey:@"CategorySaved"];
  
  NSMutableArray *testArray = [[NSMutableArray alloc] initWithCapacity:1];
  NSMutableArray *cat1 = [[NSMutableArray alloc] initWithCapacity:1];
  NSMutableArray *cat2 = [[NSMutableArray alloc] initWithCapacity:1];
  NSMutableArray *cat3 = [[NSMutableArray alloc] initWithCapacity:1];
  NSMutableArray *cat4 = [[NSMutableArray alloc] initWithCapacity:1];
  NSMutableArray *cat5 = [[NSMutableArray alloc] initWithCapacity:1];
  NSMutableArray *cat6 = [[NSMutableArray alloc] initWithCapacity:1];
  NSMutableArray *cat7 = [[NSMutableArray alloc] initWithCapacity:1];
  NSMutableArray *cat8 = [[NSMutableArray alloc] initWithCapacity:1];
  NSMutableArray *cat9 = [[NSMutableArray alloc] initWithCapacity:1];
  NSMutableArray *cat10 = [[NSMutableArray alloc] initWithCapacity:1];
  
  
  switch(CategoryLoaded)
  {
      case 1: testArray = cat1;
          break;
      case 2: testArray = cat2;
          break;
      case 3: testArray = cat3;
          break;
      case 4: testArray = cat4;
          break;
      case 5: testArray = cat5;
          break;
      case 6: testArray = cat6;
          break;
      case 7: testArray = cat7;
          break;
      case 8: testArray = cat8;
          break;
      case 9: testArray = cat9;
          break;
      case 10: testArray = cat10;
          break;
  }
  
  int test = arc4random() %17;
  while([testArray containsObject: @"test"])
  {
      test = arc4random()%17;
  }
  
  QuestionSelected = test;
  </code></pre>