Obtaining Random Numbers from irregular Ranges
<p>I want to get a random number from (0,2,6,8,4) or such ranges. Currently I loop till I get appropriate Num.</p>

<pre><code>boxNum = getRandomNum(0, 8);

  while (boxNum == 1 || boxNum == 3 || boxNum == 5 || boxNum == 7))
    boxNum = getRandomNum(0, 8);
</code></pre>

<p>Is there any other way to do this?? The while loop crashes the page after some turns.</p>