title: Generate random number from given number
body: <p>I am stuck in one issue regarding to random number. I am generating random number using <code>arc4random()</code>. I want to generate randome numbers between 0-9 at first. so i am using:</p>
  
  <pre><code>int RandomNumber = arc4random() % 9;
  </code></pre>
  
  <p>its good. Now suppose I got 8. I don't want my new random number to be 8. So I have done following:</p>
  
  <pre><code>NSMutableArray *aryTemp = [NSMutableArray new];
  for (int i = 0; i &lt; [aryTemp Count] &lt; 9; i++) {
     int RandomNumber;
     do {
        RandomNumber = arc4random() % 9;
     }
     while ([aryTemp containsObject:[NSNumber numberWithInt:RandomNumber]])
     [aryTemp addObject:[NSNumber numberWithInt:RandomNumber]];
  }
  </code></pre>
  
  <p>So I am generating a random number than adding it to array than checking for the next random number that is this the previous generated random number or not? If not than add it to the array.</p>
  
  <p>It works fine for few starting numbers but when I left of with few option at that time I have very less chances to generate desire random number and while loop processes takes lots of time due to redundant random number. </p>
  
  <p>What I am looking for I want random numbers of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  If I got 6 at first time next time the random number must be with in these numbers only 0, 1, 2, 3, 4, 5, 7, 8, 9</p>