So I am making a simple Dice that has 6 sides, but I want to modify the chances of those 6 sides.
Now my dice can have N
sides, it grows, so you start with 6 sided dice and you may get up to 10 sided dice. The chances for a specific side to come up on a roll depends on its value. Chances should decrease depending on the value on a side so if side value is 1
its chance is higher than the side numbered 6
whose chance would be much lower.
Example (6 Sided):
Side : Chance
1 : 35 %
2 : 25 %
3 : 20 %
4 : 11 %
5 : 6.5 %
6 : 2.5 %
So as sides increase the chances should decrease never going over 100.
I tried making formula depend on the side and divide the current chance by number of sides but did not work.
Edit:
Side 6 should have 6 times less probability than side 1 and 5 times less probability than side 2 and 4 times less probability than side 3 etc... My example does not match this because I could not come up with numbers so they would add up to 100 and qualify the conditions.
If I understand you correctly, you want this equation:
If the dice has N sides, the total "weight" is (N/2)*(n+1)
.1 For 6 sides, the total "weight" is (6/2)*(6+1) = 3*7 = 21
.
Then the math is simple
1 -> 6 / 21 = 0.28571428571
2 -> 5 / 21 = 0.23809523809
3 -> 4 / 21 = 0.19047619047
4 -> 3 / 21 = 0.14285714285
5 -> 2 / 21 = 0.09523809523
6 -> 1 / 21 = 0.04761904761
Obviously 6/21 is 6 times as big as 1/21, so that part holds up. And the summation:
0.28571428571 6/21
+ 0.23809523809 +5/21
+ 0.19047619047 +4/21
+ 0.14285714285 +3/21
+ 0.09523809523 +2/21
+ 0.04761904761 +1/21
--------------- -----
0.99999999996 21/21
well, the left side is close enough to 100% anyway. Rounding being what it is. Right side shows that this is a rounding thing and not an error thing.
*this equation (and the variant (N/2)*(N-1)
) are seriously handy equations. It's a shortcut for 1+2+3+4+5+6...