title: Algorithm to get 9 different numbers in an array
body: <p>I need help to create an algorithm to make 9 random numbers. Each number must not be equal to any other. Restated as 9 random numbers from 1-9.</p>
  
  <p>I had something like this in mind:</p>
  
  <pre><code>int[] numlist = new int[9];
  Random rand = new Random();
  int temp;
  foreach (int i in numlist) {
      temp = rand.Next(1, 10);
      //check if temp is already a value of a lower index in numlist
          //if so, rolls another random number and checks it again...
      numlist[i] = temp;
  }
  </code></pre>
  
  <p>I had a method that had <code>if</code>s inside for loops inside while loops inside foreach loops and such...</p>