Random 6 values: prob. picked values are 90+% of the maximum value?

mige

New member
Joined
Nov 8, 2017
Messages
2
So yeah, heres my math problem:

I have 6 values between 0-31, which each are randomly picked and every value has an equal chance to be picked. (also same value can be picked multiple times)
74wLb3Z.png

^So lets say I ended up with those values, and thats only 52,15% of the maximum possible.

How do I calculate the chance that the picked values are 90+% of the maximum value? (or 80+% or whatever percentage, if u can come up with a formula that I can easily check chance of different percentages that would be great)

If the formula for solution is long excel file would be awesome :)
 
Last edited:
Consider the Random Variable: \(\displaystyle Y = X_{1}+X_{2}+X_{3}+X_{4}+X_{5}+X_{6}\)
 
Consider the Random Variable: \(\displaystyle Y = X_{1}+X_{2}+X_{3}+X_{4}+X_{5}+X_{6}\)
Sorry that doesnt really get me anywhere.

I have tried thinking it like this if all the values are 25 or higher its 80+%. with this method u can consider there being only 7 acceptable values for each of them out of 32.

so 7/32 chance for each... so the chance would be 7/32*7/32*7/32*7/32*7/32*7/32 = ~0,01%

But yea I also simulated this, to get an estimate... it was over 80+% 40-70 times out of 10000 tries, so that would be somewhere around ~0,5%
Code:
import java.util.Random;


public class Main {


    public static void main(String[] args){
        int val1 = 0;
        int val2 = 0;
        int val3 = 0;
        int val4 = 0;
        int val5 = 0;
        int val6 = 0;
        float max = 6*31;
        float current = 0;
        int i80 = 0;
        int runs = 10000;
        for(int i = 0; i < runs; i++){
            val1 = (int)(Math.random() * 32);
            val2 = (int)(Math.random() * 32);
            val3 = (int)(Math.random() * 32);
            val4 = (int)(Math.random() * 32);
            val5 = (int)(Math.random() * 32);
            val6 = (int)(Math.random() * 32);
            current = val1+val2+val3+val4+val5+val6;
            float percent = current/max*100;
            if(percent >= 80)
                i80++;
        }
        System.out.println(i80+"/"+runs);
    }
    
}

PS. Im an indie gamedeveloper, and would like to know the chances of certain things happening in my game, since I was planning to have certain things triggered when the percentage is high enough... But I guess I'll just go with simulating it to get some sort of estimation if I cant calculate it.
 
Last edited:
Top