Random Generators using percentages
| From: | Real GM Webmaster | Date: | Thu, 30 Nov 2000 08:45:28 +0000 |
| Subject: | Random Generators using percentages | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-27999@lists.php.net to get a copy of this message | ||
Hi,
I have a problem that I do not know if it has been covered or not. I understand the random
generator process, but I am unsure how to apply this to my task.
Basically, what I do is take thirteen people and assign percentages of probabilities to them. I
then draw the first three out of the thirteen, and if a person comes up again I draw again, so I
have three unique names.
Basically there is 1000 entries divided up into the 13 people. The number of entries for each looks
like this:
Person 1 - 250... 25% chance of getting #1, 21.55% chance of getting #2, and 17.84% chance of
getting #3
Person 2 - 200... 20% chance of getting #1, 18.91% chance of getting #2, and 17.22% chance of
getting #3
Person 3 - 157... 15.70% chance of getting #1, 15.84% chance of getting #2, and 15.70% chance of
getting #3
Person 4 - 120... 12% chance of getting #1, 12.71% chance of getting #2, and 13.43% chance of
getting #3
Person 5 - 89... 8.90% chance of getting #1, 9.77% chance of getting #2, and 10.82% chance of
getting #3
Person 6 - 64... 6.40% chance of getting #1, 7.21% chance of getting #2, and 8.26% chance of getting
#3
Person 7 - 44... 4.40% chance of getting #1, 5.06% chance of getting #2, and 5.93% chance of getting
#3
Person 8 - 29... 2.90% chance of getting #1, 3.38% chance of getting #2, and 4.03% chance of getting
#3
Person 9 - 18... 1.80% chance of getting #1, 2.12% chance of getting #2, and 2.56% chance of getting
#3
Person 10 - 9... 0.90% chance of getting #1, 1.07% chance of getting #2, and 1.30% chance of getting
#3
Person 11 - 9... 0.90% chance of getting #1, 1.07% chance of getting #2, and 1.30% chance of getting
#3
Person 12 - 6... 0.60% chance of getting #1, 0.71% chance of getting #2, and 0.87% chance of getting
#3
Person 13 - 5... 0.50% chance of getting #1, 0.60% chance of getting #2, and 0.73% chance of getting
#3
As you can see the probabilities are very top heavy, and this will not be your usual random number
generator at work here. Person 1 has a better chance at getting place number 1 than they have of
getting number 3. Person 13 has a very slim chance of getting into the top three, but there still
is a chance.
Has anyone got any idea on how I could do this?
Thank you VERY much in advance,
Michael Benbow.