Actionscript 3 while loop with indexOf
- by Hanpan
Hi,
Is there any reason why this loop is getting stuck? I can't quite get my head around it:
var i:Number = -1;
do
{
i = Math.round(Math.random() * _totalQuestions);
}
while(_usedQuestions.indexOf(i));
Where _usedQuestions is an array of numbers. This array starts empty.
Thanks!
Edit: I want the loop to end if i is NOT found in the array.. this way I know the question I have selected has not previously been asked.