title: Random generator Objective-C
body: <p>I've declared a static array of integer from 1 to 5 and now want to call randomly each number with each press of a button. I don't want the same number to be called twice.</p>
  
  <pre><code>int randomNumber;
  static int size = 5;
  
  int position = arc4random() % size - 1;
  randomNumber = usedNumbers[position];
  int switcher = usedNumbers[size]; // wrong
  usedNumbers[position] = usedNumbers[size];
  size--;
  usedNumbers[position] = switcher;
  </code></pre>
  
  <p>Here's what I've done so far. There's a hole in my logic somewhere and I could do with some help. I think it's something to do with the switcher which is trying to hold a number whilst another is being deleted.</p>