title: Random number in Objective-C
body: <blockquote>
    <p><strong>Possible Duplicates:</strong><br>
    <a href="https://stackoverflow.com/questions/160890/generating-random-numbers-in-objective-c">Generating random numbers in Objective-C</a><br>
    <a href="https://stackoverflow.com/questions/4059049/ios-random-numbers-in-a-range">iOS Random Numbers in a range</a><br>
    <a href="https://stackoverflow.com/questions/2612784/generate-non-repeating-no-sequential-numbers">Generate non-repeating, no sequential numbers</a>  </p>
  </blockquote>
  
  
  
  <p>I am looking for method that give me random numbers between two numbers, and the first number will be number that I choose between the numbers.</p>
  
  <p>for example, if I give this random function 5 and 10 and 9 as the first number, so it will give me: 9,10,7,6,5,8</p>
  
  <p>I tried to use it: </p>
  
  <pre><code>NSUInteger count = [array count];
  for (NSUInteger i = 1; i &lt; count; ++i) {
          int nElements = count - i;
      int n = (random() % nElements) + i;
      while (n==`firstnumber`) {
          n = (random() % nElements) + i;
      }
  }
  </code></pre>