I have some sort of a math issue : I have to implement an algorithm that randomly generates winners and losers based on :
- a maximum number of players
- a percentage of winners to reach
Of course, the more winners, the smaller the effective percentage will be, but in the end, when the total number of players reach the maximum number that was set, the exact percentage of winners must be reached too.
In other words, if I set the maximum number of players to 500 and the percentage to 10%, I have to reach exactly 50 winners (no less, no more) by the time I reach 500 players. I tried to do some math, but I'm not really good at it, so I'm looking for your help ;)
EDIT : here's another try to explain my problem since it seems that I'm confusing people :D :D
It's a game on iPad where people come and play. An admin first sets the maximum number of users and the percentage of winners he'd like.
Then, people come and play, one at a time, and when they do, they are notified instantly if they won or not. By the time the game reaches the maximum number of players that was initially set, I must have the correct percentage of winners based on what was initially set. I hope this description is more clear ;)
Thanks a lot for your help.