# What I do in my spare time (to prove to myself how huge of a nerd I am)

November 9, 2009 4:31 pm 41 CommentsEver get a problem in your head that you obsess over for days, or even weeks (or longer)? This is the one I’ve been working on for a while.

At some point, I started to wonder about dice rolling. Specifically, I wondered about the difference between rolling a single 12-sided die and two 6-sided dice. How do the two compare? Obviously, with a 12-sided die (which I will refer to as d12, in grand D&D tradition) every number on the die has an equal chance of being rolled (8.33%), ignoring variations in dice shape, weight, texture, etc.

But what about when you use a pair of six-sided die (d6)? Like a d12 (or any properly made dice) each number has the same chance of being rolled (16.67%). But when using them in a game, you add them up. How does that affect your odds of getting certain numbers?

First of all, the obvious: there’s no way to roll a 1 with 2d6 (that’s 2 six-sided die). Second, since rolling two of the same number is rare, that would mean that scoring a 2 or 12 (the lowest and highest scores you can get) would be equally rare. With that in mind, I assumed that I’d be looking at a Bell Curve of some sort.

Well, the idea kept gnawing at me, and finally I decided to run an experiment and collect the data myself. I created a program in Flash (which was a great opportunity for me to practice using Actionscript 3) that would roll the dice for me and display the result.

Each “loop” in the program represents a roll, in which both 1d12 and 2d6 are rolled at the same time. The program tallies up which number comes up for the d12, and it adds and then tallies the score for the 2d6. For something that’s based purely on random numbers, lots of tests (rolls) need to be done, so I set it to roll the dice 1,000 times. Fortunately, computers make tedious tasks easy (and easy tasks tedious). Eventually I upped the number of rolls to 10,000 and then 50,000. I consider that a very solid sample size.

Here’s the final result. When the number of rolls is low, the numbers are all over the place, but it eventually normalizes once you have a larger amount of data (which shows exactly why you need a large sample size when doing a scientific experiment). Go ahead and re-run the experiment a few times. It’ll automatically stop at 50,000.

As expected, the d12 is a straight line, and shows the predicted 8.3%. But the 2d6 results are much more interesting. The odds of rolling a 7 are double the odds of any roll on a d12. Also interesting is that 4 and 10 are equally likely to be rolled on 2d6 as on a d12.

It’s probably obvious to a lot of you by now that I don’t gamble. These results probably aren’t surprising to anyone with experience in rolling dice, or to anyone who’s familiar with basic Statistics. Oh well.

So, how do we apply these results to real life? Well, let’s say you’re playing Dungeons & Dragons, where the amount of damage your character does to an enemy per round depends on what you roll with your dice. Let’s say you have a choice between a greataxe that does 1d12 damage or a greatsword that does 2d6 damage (actual base properties used). You obviously want the one that does the most damage. But is there a difference? Clearly, with the greatsword, you’re most likely to roll between 5-9 and unlikely to roll 2, 3, or 11. It has much more predictable numbers, though you’re more likely to get higher (and lower) numbers with the greataxe.

But when you figure out the odds of each number being rolled, a clear difference emerges. The average damage done by the greataxe is 6.5. The average damage done by the greatsword is 7.

I could’ve gotten those results if I had just found the average of all possible rolls in the first place.

(1+2+3+4+5+6+7+8+9+10+11+12)/12 = 6.5

(2+3+4+5+6+7+8+9+10+11+12)/11 = 7

Argh. Whatever.

**UPDATE (Dec 30, 2009):** Ever since I posted this, I’ve been itching to add rollers for 3d4, 4d3, and 6d2 (aka $1.50). So I did. And as expected, they show up as bell curves. So the more variables you have, the smoother the bell curve will be. Maybe someday I’ll do this with 1000d1000. I wonder if 50,000 rolls would be enough…

Categorised in: Before 2011, Stuff I Made, Type - Post

This post was written by Bevans

- Disqus
- Google+