Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with a Java programming assignment
#2
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.
Reply


Messages In This Thread
Need help with a Java programming assignment - by Russt - 2009-12-04, 09:19 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)