title: Generate a non-repeating random number in JavaScript
body: <p>How do I ensure that I don't get a repeat of a random number? Right now, this isn't working. I'm using a local array to store previous results.</p>
  
  <pre><code>getUniqueRandomNumber(x){
       var index;
       var viewedIndices = [];
       index = Math.floor(Math.random() * (x));
       if(viewedIndices.includes(index)) 
       {
         viewedIndices.push(index);
         this.getUniqueRandomNumber(x);
       }
       else { 
         console.log(index);
         return index;
      }
   }
  </code></pre>