2009-12-04, 09:19 PM
The problem is that your algorithm just chooses 8 random numbers - it doesn't care whether there are repeats. When only 7 winners are displayed, that is because it chose one of them twice.
If you're allowed to rearrange the array, I think you can shuffle it (or partially shuffle it) and then print the first 8 as winners and the rest losers. If not, or if the IDs don't work the way I assume they do, you'll have to find some way of "re-rolling" IDs if they are already taken.
If you're allowed to rearrange the array, I think you can shuffle it (or partially shuffle it) and then print the first 8 as winners and the rest losers. If not, or if the IDs don't work the way I assume they do, you'll have to find some way of "re-rolling" IDs if they are already taken.

