title: populate array with UNIQUE random numbers javascript
body: <p>I have an array :</p>
  
  <pre><code>var array = new Array();
  </code></pre>
  
  <p>Here is the random function, which gives a random number between <code>min</code> and <code>max</code> (seen in a previous Stackoverflow topic) :</p>
  
  <pre><code>function randomIntFromInterval(min,max) {
      return Math.floor(Math.random()*(max-min+1)+min);
  }
  </code></pre>
  
  <p>This array is meant to have 9 cells. I would like to populate it with random number, with the important condition that each of those number are unique, which means a number in this array cannot be found twice or more.So finally, here is where I am stuck (whole code) :</p>
  
  <pre><code>var array = new Array();
  
  function randomIntFromInterval(min,max) {
      return Math.floor(Math.random()*(max-min+1)+min);
  }
  
  // populate the variable "array" with 9 different
  // random numbers
  function randomlyInitializeArray() {
      var random = 0;
  
      // For each cell (9 cells) in my "array"
      for (var i = 0; i &lt; maxLength; i++) {
  
          // Return a number between 1 &amp; 9
          random = randomIntFromInterval(1, maxLength);
  
          /*  Verifying if this random number is already in 
              the "array" /!\ stuck here /!\ */
      }
  }
  </code></pre>
  
  <p>So, what is the logic for populate an array with 9 unique (different) number ?</p>