title: Random array between given range of integers, containing at least one instance of each integer in the range
body: <p>I'm trying to generate an array that contains a random set of integers between a range that will contain at least one instance of each possible integer. I can generate an array with random integers between a range, but cannot figure out how to generate one that contains at least one instance of each integer in said range. I'm trying to generate an array that contains 84 keys with a range between 0 and 40 (including 0 and 40). The array should contain at least one instance of each possible integer in said range. This is the code that I have right now:</p>
  
  <pre><code>&lt;script&gt;
      ints = [];
  
      function sortInt(a, b) {
          return a - b;
      }
  
      for (i=0; i&lt;84; i++) {
          ints.push(Math.round(Math.random() * 40));
      }
  
      ints.sort(sortInt);
  
      for (s=0; s&lt;ints.length; s++) {
          document.write(ints[s] + '&lt;br /&gt;');
      }
  &lt;/script&gt;
  </code></pre>