title: C# creating a list of random unique integers
body: <p>I need to create a list with one billion integers and they must all be unique.  I also need this to be done extremely fast.</p>
  
  <p>Creating a list and adding random numbers one by one and checking to see if each one is a duplicate is extremely slow.</p>
  
  <p>It seems to be quite fast if I just populate a list with random numbers without checking if they are duplicates and then using distinct().toList().  I repeat this until there are no more duplicates.  However the extra memory used by creating a new list is not optimal.  Is there a way to get the performance of distinct() but instead of creating a new list it just modifies the source list?</p>