Nice one, Sammy.
Note though, this may require some fairly sophisticated coding. (Hm, sounds like a good topic for a sample in the Articles area). What you need to be wary of, johnny, is just incorrectly "stacking" the percentages. A fairly common method of doing something a certain percentage of the time is like this...
- Generate a random number between, say, 0 and 100.
- If the number is <= my percentage, then we have a hit.
This works just fine. But in a case like this where you are choosing between a number of options, the natural inclination might be somethinbg like this (using Sammy's example)...
- Generate a random number between 0 and 100.
- If the number is <= 30, press 1
- Generate a random number between 0 and 100.
- If the number is <= 50, press 2
- Generate a random number between 0 and 100.
- If the number is <= 20, press 3
It may seem as though this would do what you want. But in fact this would change the probabilities quite significantly. For instance, this only allows something like (my math may be wrong) a 35% chance of generating a "2". And if I'm not mistaken, a 7% chance of producing a "3". (I don't have much confidence in my numbers, but hopefully you get the idea.)
So, just be aware of this pitfall.