• The VOIDRUNNER'S CODEX is coming! Explore new worlds, fight oppressive empires, fend off fearsome aliens, and wield deadly psionics with this comprehensive boxed set expansion for 5E and A5E!

Probability Distribution of Dice

Riveneye

First Post
First off, I apologise if this is in the wrong forum, but it really was hard to decide where to put it, this question doesn't seem to fit into any forum really. Anyway, if this is in the wrong place, feel free to move/delete/whatever it ;)

Now, are there any mathematicians here? I got the idea to write a script that would spit out the % chance of getting a certain roll with certain dice in my IRC game (just to feed our curiosity at times), but am stumped on how to write such a script when large amounts of dice are used. As soon as more than 2 dice are introduced, the amount of manual work that I need to do to calculate the probabilities is enormous. Does anyone know of a formula I could use? There has got to be one around, but I certainly can't find one.
 

log in or register to remove this ad

Xeriar

First Post
You can use the standard deviation formula, inputting it into Excel or some other program, say.

For example, 3d6 has a mean of 10.5 and a Standard Deviation of ~2.95. This is a little rough, but you can verify it for yourself.

Over 2/3rds of the population is within one Standard deviation of the mean (7.55-13.45), another 2/7ths are between one and two deviations (4.6-7.55 and 13.45-16.4), 2/46ths (1.65-4.6, 16.4-19.35)...

As you can see, this is an approximation, and it also extrapolates beyond what the dice can physically represent. This can be useful for determining what a given ability score should mean (if you're paying careful attention to detail :p )

As more deviations get factored in, the probabilities get drastically smaller, of course - one in a billion for being six standard deviations above the mean, even (which would equate to a half dozen people on earth with an intelligence score of 28 - maybe one with a 29).
 

diaglo

Adventurer
take a course of statistics, probability or become an actuary.

or do all of the above.

Excel can handle some of this.

why not use a random dice roller. there are many available on the net?
 

ichabod

Legned
If you are using a fair number of dice at once, and are just curious (don't need exact numbers), the normal approximation is probably the way to go. A die with s sides has a mean of (s+1)/2, and a variance of (s-1)^2/12 (assuming it's numbered 1 to s). Figure out the mean and variance for all of the dice you are rolling at once, and add them up to get the mean and variance for the total of all the dice. Now take the square root of the variance to get the standard deviation.

Now, approximately 68% of the rolls will fall within 1 sig (standard deviation) of the mean. Approximately 95% of the rolls will fall within 2 sigs of the mean, and approximately 99.5% of the rolls will fall within 3 sigs of the mean. If you are more interested in specific numbers, you can do one of two things. You can use a programming language that gives probabilities for normal random variables (a lot of them do), or you can standardize your values and use a table of the standard normal distribution, like the one here . To figure the probability of rolling n or less, look up ((n+1/2)-mean)/standard deviation on the table. To figure the probability of rolling n or more, look up ((n-1/2)-mean)/standard deviation on the table, then subtract it from one. To figure the probability of rolling n, subtract the second value you got of the table (before subtracting from one) and subtract it from the first value.

Again, these are going to be approximate, and more dice you are rolling at once, the better the approximation will be. If you want exact values, it gets either slow or messy. Slow is having the computer figure out the sum of every possible roll, and then determining the distribution from that. Fine for small number of dice with a low number of sides, but it can bog down when you get into high values of either. Messy is to figure the combinatorics. I'm having too frustrating a day to even get into that.
 

pawned79

First Post
I am an aerospace engineer, so here's my input...

First off, dice do not a gaussian distribution, they are a rectangular distribution. No matter what anyone says, you are equally as likely to roll a 1 on a d20 as you are as rolling a 10 (assuming the die was PERFECT).

So, for a single die, lets say a d6, you have to generate a random interger between 1 and 6, with an equal distribution. If you have any spreadsheet program like Excel, or if you happen to have MathCAD or MathWork's MatLAB, this is really easy. I have a Texas Instruments TI-83 calculator, and it will even generate a random interger for me. Remember, you want a rectangular distribution, or equal distribution, or symetric distribution, blah blah. If you see something that asks to input a standard deviation, you don't want that.

Now, the big problem is generating the random number. If you want to write code to actually generate a random number, you've got a LOT of work ahead of you. A lot of a nerdy guys get paid a lot of money to do that. Now, I'm not sure, but mIRC might already have a random number generator.

I would handle each die individually, and then sum them up depending on how many dice you are throwing. If two rectangular distributions are combined (ie a pair of dice), you get a triangluar distribution. If you combine three or more dice, your distribution quickly begins to look like a gaussian distribution.

Now, looking back, I know I've typed a lot of garbage, and I don't know if any of it actually helped. If you are not a code writting kinda guy, but you do actually have Microsoft Excel or something similar, send me an email, and I'll write you a code and email it back.

I can't make a random number generator though, but I know how to manipulate them to get what I want... that's engineering. ;-)

Patrick
 



Zander

Explorer
I could be mistaken, but I don't think anyone who has posted so far has understood Riveneye's question. What he wants is not a summary statistic such as the mean or standard deviation. He's after the formula/code to generate the frequency of a particular outcome for n dice with x, y, z etc number of sides. For example, if you roll 1d4, 1d8 and 2d10 together, what is the % frequency of rolling a 4. What if it's 1d6, 1d10 and 1d20 and the frequency you want to know is 21?

The answer boils down to a fraction where the denominator is all the possible outcomes and is calculated by multiplying the s values for all the dice. For example, in the case of 1d4, 1d8 and 2d10, the denominator is 3200 (4 x 8 x 10 x 10). The numerator is the number of permutations that give a particular result. For example, there is only one way of rolling a 4 with 1d4, 1d8 and 2d10: if all four dice roll 1's. The frequency of this outcome is 0.03125% (1/3200). What Riveneye wants is a formula that allows him to figure out the frequency whatever the number of dice, sides and desired outcome...

... at least that's what I think he wants! :confused:
 


Drawmack

First Post
Zander said:
For example, in the case of 1d4, 1d8 and 2d10, the denominator is 3200 (4 x 8 x 10 x 10).
This is the easy part.

The numerator is the number of permutations that give a particular result. For example, there is only one way of rolling a 4 with 1d4, 1d8 and 2d10: if all four dice roll 1's.

Does anyone know this formula? I have been attempting to work one out for a little while now. I have arrived at the following delusions.

1) It is a parabola with x = result and y = permutations to create that result.

2) The minimum x = the number of dice rolled, the maximum x is the total of all the dice's sides.

3) It peaks somewhere around the middle of the specturm (i.e. 5d4 peaks at 10)
 
Last edited:

Remove ads

Top