title: Random number generation with no duplicate values for insertion sort
body: <p>Hello i have been working on insertion sort on set of numbers. i am able to add them to the array  for performing the sorting but i was not able to generate unique values with large set of numbers to performing sorting(i:e)for 1000 values .is there any possibility i can generate unique random numbers for performing the sorting without adding values to the array? </p>
  
  <pre><code>public class InsertionBinary
  {
  
      public static void main(String Args [])
      {
          int[] nums = {1, 2, 3, 4, 5, 6, 7, 8, 24};
          print(nums);
          insertionsort(nums);
          print(nums);
          int loc = binarySearch(nums, 3);
          System.out.println("2 is in position" + loc);
      }
  
      private static void swap(int[] list, int from, int to)
      {
          int temp = list[from];
          list[from] = list[to];
          list[to] = temp;
      }
  
      private static void print(int[] list)
      {
          for (int i = 0; i &lt; list.length - 1; i++)
              System.out.
          print(list[i] + ", ");
          System.out.println(list[list.length - 1]);
      }
  
  
      private static void insertionsort(int[] list)
      {
          int key;
          int spot;
          for (int pass = 1; pass &lt; list.length; pass++)
          {
              key = list[pass];
              for (spot = pass - 1; spot &gt;= 0 &amp;&amp; list[spot] &gt; key; spot--)
                  list[spot + 1] = list[spot];
              list[spot + 1] = key;
  
          }
      }
  }
  </code></pre>