title: Unique random number algorithm
body: <p>I would like an algorithm/function that, given a number N, generates random numbers from 0 to N - 1 in constant time.  After the Nth call, the function may do as it pleases.  Also, it is important that the algorithm generates the numbers when requested rather than using shuffling, because I may (and in the average case do) not need the full list of numbers.  What is the best approach to take?</p>
  
  <p>(optional to read) I thought of having a hash set of numbers, and pulling the numbers out one at a time, but this would require inserting all elements (which I often do not need) into the hash set first... this will not work... Argh</p>
  
  <p>Thanks for any help in advance.</p>