title: Generating non-repeating random numbers
body: <p>I want to create a function in C. It will return a random integer in-range of N like:-
  rand() % N;
  but the thing is I want to keep track of uniqueness. I don't want the numbers to repeat. but i can also do this by making an array and copying the generated integers in it. like :-
  <code>array[count] = rand() % N;</code> and check every time if the number generated was already inside it or not. (simply by searching it inside the array[]); this is a simple approach but a correct one. it will take many if's and for's; for this to work.
  this is the best i can come up with.</p>
  
  <hr>
  
  <p><em>The thing is, I want to get the best possible/optimized solution for this problem. What will be the most efficient way to do this?</em></p>
  
  <p><em>lets clear some things:-
  i want to set some text in a UILabel from a NSArray that is always unique. my NSArray is getting data from a Plist, and my Plist has over 1000 entries. if i want to do this many times it will effect the performance so i want some efficient way to do this.</em></p>