title: Infinity loop with generating random numbers?
body: <p>I'm working on a script that creates random mathematical problems (simple questions). The problem is that there seems to be an infinite loop, and I can't figure out where or how my script can run without this part of the code.</p>
  
  <p><a href="https://codepen.io/abooo/pen/GyJKwP?editors=1010" rel="nofollow noreferrer">https://codepen.io/abooo/pen/GyJKwP?editors=1010</a></p>
  
  <pre><code>var arr = [];
   var lastArr = [];
  
  
  while(lastArr.length&lt;122){
      arr.push('&lt;br&gt;'+Math.round(Math.random() * 10)+'+'+Math.round(Math.random() * 10)+'=');
    lastArr=removeDuplicates(arr);
  
  }
  document.write(lastArr.join(' '));
  
  alert(arr.length);
  
  
  function removeDuplicates(arr){
      let unique_array = []
      for(let i = 0;i &lt; arr.length; i++){
          if(unique_array.indexOf(arr[i]) == -1){
              unique_array.push(arr[i])
          }
      }
      return unique_array
  }
  </code></pre>