title: Randomly selecting N distinct numbers without repetition
body: <p>I want to have a set of randomly selected N distinct numbers from {1,2,...(k-1),K} where K>N. I want to write a C program to efficiently do this.</p>
  
  <p>Any help appreciated.</p>
  
  <p>Note:</p>
  
  <p>The naive program is just to generate random number, check whether it has been already generated and if not add it to the list is easy to implement. I was looking for something more efficient as if K and N are comparable then this will be just inefficient computation.  </p>