Random option with different probability
Hello,
I'm looking for some help with something or maybe just a nudge in the right direction. Here's what I'm trying to do:
When player clicks certain item or icon I would like to give him 1 out of 4 options, but with different probability. For example, if a player clicks START MISSION, he would get one of 4 mission types (easy,normal,hard or very hard) but the chances would be 50% for easy,30%normal,20%hard and 10%very hard for instance. How would one accomplish something like this?
Thanks for any help
2 Attachment(s)
Another Solution for picking would be...
With all the respect to all the previous answers, I would do it like this.
First, properly distribute your percentages. You can't have 50,30,20,10, cause the sum is 110%. That's not realistic. However you could do it if you want the odds to be 50 of 110, 30 of 110 etc.
But let's talk about a 100% sum. Let's distribute the difficulty levels:
1 - easy - 50%
2 - normal - 30%
3 - hard - 15%
4 - very hard -5%
50+30+15+5 = 100 so we are ok.
Now if you ask for a random number between 1 to 100, you can have the first 50 numbers be easy, the next 25 the normal etc. meaning:
1. 1-50 -> easy
2. 51-80 -> normal
3. 81-95 -> hard
4. 96-100 -> very hard
In order for this to work properly I have to assume that the random pick of fusion is indeed following the statistical rules (it is a true random with equal odds to pick any of the numbers).
Therefore the code is the following:
Attachment 27173
Here is the MFA if you want to test. - Attachment 27172