Page is a not externally linkable
shingokko - 1:57 am on Apr 25, 2012 (gmt 0)
You just need to alter the code in the for loop a little bit so that the loop will only be used to find whether there are more than or equal to two of the same number. You just need to check the value of count right after the loop and add the number to the array if there are less than two of the same number in the array.
Here's how I would change the code inside the while loop:
for (var i = 0; i < Cards.length; i++) {
if (Cards[i] == rndNum) {
count++;
if (count >= 2) {
break;
}
}
}
if (count < 2) {
Cards[Cards.length] = rndNum;
}
Hope this works.