# Thread: Statistics of dropping dice

1. ## Re: Statistics of dropping dice

Originally Posted by Sivarias
I was actually referring to jeenlean's idea because that seems to be the way to calculate it manually. You create an array with every possible combination and go through checking for the highest values.
Yeah, that's what my idea does (or should do.)

It made the array as big as you needed, so if you have 10d6, it'd be ten columns (one for each die) and as many rows as you needed to do every possible combination.
In my idea, I tested the code using 100d100, and it took a noticeable time to run*, but it still ran fine. This was using R on an about-5 or 6 year old computer (though the computer was decent when new. Not top of the line, but pretty good).
*I forget the details, but about a minute to a few minutes. It wasn't something like a "leave it running for 20 minutes" job.

For this purpose (getting a distribution of dropping lowest die, as opposed to mine of getting a mean), you'd need to add another loop to take out the lowest value and then store the sums somewhere else to get your distribution, but I reckon that wouldn't be computationally expensive.

2. ## Re: Statistics of dropping dice

I guess it depends on your environment what implementation makes sense, but in general there is no reason to keep that much data around at once in a big table like that.

For the brute force method, you only need a single 1 dimensional array with a number of elements equal to the maximum possible roll (obtained by adding up the sides of all the dice if you rolled the highest value on each). Initialize the array to 0 in every element. Go through every possible permutation of dice rolls, and for each permutation, calculate what the sum of the roll would be after applying rules like drop N, then increment the array element for that value by 1. In the end you have an array that tells you the relative frequency for every possible roll. To convert them into a fraction, you just divide the integer in each element by the total number of permutations you went through.

As for how you go through every possible permutation, I discussed one easy way to implement that that requires two small arrays equal to the number of dice rolled.

3. ## Re: Statistics of dropping dice

In my experience, dropping dice results in lost dice.

Hope this helps!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•