title: AS3: How to check if a value already exists in the Array before adding with FOR loop?
body: <p>I believe is something simple but obviously not simple enough :). Any ideas how to check if a value already exists in the Array before adding the value using FOR loop?</p>
  
  <p>I have this so far and it doesn't work as I want to because the Array can contain duplicate values!</p>
  
  <pre><code>            var n:int = 5;
          var cnt:int;
          for (var i = 0; i &lt; n; i++)
          {
              cnt = randomThief();
  
              for (var a = 0; a &lt; loto5.length; a++)
              {
                  if (loto5[i] == cnt)
                  {
                      loto5[i] = cnt;
                  }
              }
          }
  </code></pre>