Statistics Question


Homebrew and House Rules


1 person marked this as a favorite.

I'm trying to create a table or series of tables that uses a d12s to generate either an number from 1 to 13 or 1 to 26. I want an even distribution. I don't mind if there are "reroll" options on the tables, but I want as few tables to roll on as possible.

Can this be done? If so, how?

I don't have to use d12s, but for simplicity for a character I'm using it would really make it easier and more enjoyable for me. If I can't do it, I'll just have to live with it.


Roll 13d12 in order; the highest roll is the number generated (re-roll ties).

Ex: 3, 6, 12, 5, 4, 7, 9, 2, 12, 2, 4, 7, 3, 8.

The third & sixth rolls were tied, roll randomly to see which number was generated.
1d2=2; therefore the number six was generated.

If you need numbers from 1 to 26, simply:
1. double the results from generating numbers from 1 to 13
2. roll 1d2-1
3. subtract the number generated in step #2 from the number generated in step #1

Ex: six was generated, and 6*2=12; 1d2-1=0; number is 12
Ex: six was generated, and 6*2=12; 1d2-1=1; number is 11

13 is a prime number so I can't think of a way to narrow it down further than that, sorry


You're not going to get a uniform distribution involving a multiple of 13 without a n*13-sided die (where n=1,2,3,...).

exact option:
roll 1d20 (reroll outcomes from 14 to 20)

approximate solution:
(1) roll 1d1000 for a uniform result from 0-999
(2) divide by 77 (dropping any remainder)
(3) add 1

result (probability)
13 (76 / 1000)
12 (77 / 1000)
11 (77 / 1000)
...
2 (77 / 1000)
1 (77 / 1000)

probability of getting 13 is slightly less than the others, so it's not exactly uniform. Depending on your purpose, it might be "close enough".

another exact solution, but likely won't work for your purposes:
(1) draw a card from a standard deck
(2) ace = 1; number = number; jack=11, queen=12, king=13


I was hoping that there was an easy way to just use a d12. I have plenty of ways of generating a random number. It's probably not easily done looking at the responses already. Oh well. I'll just have to suck it up and do it the better way.


Using just a d12, you'll always have an integer multiple of 12 possible outcomes: for 'n'd12, you have 12^n outcomes. That will never be evenly divisible by 13, so you cannot assign the same number of outcomes to each number 1 to 13. Impossible to get the uniform distribution you desire.


We can get REALLY close to how you want this to work (143/144):
1. Roll 2d12, we need to know which is which. Reroll if both are 12.
2. If the second die is less than or equal to the first die, add one to the first die for your result, otherwise use the first die.

A roll of double twelve would give 14; reroll in this case for perfect probability, or stay at 13 for a good estimate.

I even made a table for you. Green is the first die, blue the second.

EDIT: for 1-26:
1. Roll 3d12, we need to know which are which. Reroll if dice one and two are twelve.
2. If the second die is less than or equal to the first die, add one to the first die for step 3, otherwise use the first die for step 3.
3. Double what you have; if the third die is even, subtract 1.


Pseudos wrote:

We can get REALLY close to how you want this to work (143/144):

1. Roll 2d12, we need to know which is which. Reroll if both are 12.
2. If the second die is less than or equal to the first die, add one to the first die for your result, otherwise use the first die.

With the minor correction that the {12,12} result gives 13 rather than 14, this algorithm works giving 13 a slightly higher probability than the others.

Re-rolling {12,12} corrects back to perfect probability: 143 total outcomes and assigns 11 of them to each number from 1..13.

Once you have 1-13, you can just roll any third die and maybe do something like "even/odd":
(even) keep the 1..13 result
(odd) add 13 to get a 14..26 result

[many other systems will exist to get you from 1..13 to 1..26]


ForkOfSpite wrote:

With the minor correction that the {12,12} result gives 13 rather than 14, this algorithm works giving 13 a slightly higher probability than the others.

Re-rolling {12,12} corrects back to perfect probability: 143 total outcomes and assigns 11 of them to each number from 1..13.

You are rewording exactly what I have already said in my original post. (before the edit) The alternate method of getting from 1-13 to 1-26 is potentially better, but it feels like your post is trying to pass of my work as your own. My edit was pretty fast as well; if you take a long time preparing a post, don't forget to preview it to see if someone has posted or edited in your absence, rending yours redundant.


I think I just figured out a potential solution. I'm just going to roll 1d12 + (1d12/2) -1. I don't think that this will make a huge difference in the distribution. If it might, please let me know. I'm not really much into statistics.


In order to keep perfect distribution, you want to avoid adding the results of two dice rolls. This is what begins to create the bell curve shape on the distribution graph.

Getting 1-13 on a 12 sided die evenly with no rerolls should be impossible. The easiest method is with a d20 as mention by ForkOfSpite.

Wouldn't 1d12 + (1d12 / 2) - 1 give a range of 1 - 17 if you round up? Instead of the 1-13 you wanted?


I meant 1d12/6 (so I could get a result of 1 or 2) then subtract 1.

It looks like I won't be able to do what I want. It's a weird quirk that fits my character in a 13th Age Game. I was hoping that I could pull it off with just the d12. Looks like it's possible, but I don't want to roll that many times. I'll just have to deal with it and roll my d14 and reroll 14s.


You own a d14?


alright so 13 options you roll 1 d6 (or whatever 50/50) 1-3 you roll 1d8 and use the bottom half of the chart options 1-8
d6 gets 4-6 you roll 1d10 half the result to get options 9-13.
with 9 being 1-2 10 being 3-4 etc on the d10.


Boomerang Nebula wrote:
You own a d14?

Yup. I just wanted to see if there was a way to use a d12 effectively.


Vidmaster7 wrote:

alright so 13 options you roll 1 d6 (or whatever 50/50) 1-3 you roll 1d8 and use the bottom half of the chart options 1-8

d6 gets 4-6 you roll 1d10 half the result to get options 9-13.
with 9 being 1-2 10 being 3-4 etc on the d10.

I know that it seems weird that I'm stuck on the d12. I have very good reasons for it, but if it can't be done with a d12 then I'll just have to use my d14 and reroll 14s. It will be the easiest, next best solution. I just had my heart set on the d12.


Bob_Loblaw wrote:
Boomerang Nebula wrote:
You own a d14?
Yup. I just wanted to see if there was a way to use a d12 effectively.

Pseudos provided the most mathematically elegant solution, however if you are looking for a simpler but less elegant solution then roll d12 once for results 1-12 and an edge counts as 13.


Bob_Loblaw wrote:
Vidmaster7 wrote:

alright so 13 options you roll 1 d6 (or whatever 50/50) 1-3 you roll 1d8 and use the bottom half of the chart options 1-8

d6 gets 4-6 you roll 1d10 half the result to get options 9-13.
with 9 being 1-2 10 being 3-4 etc on the d10.
I know that it seems weird that I'm stuck on the d12. I have very good reasons for it, but if it can't be done with a d12 then I'll just have to use my d14 and reroll 14s. It will be the easiest, next best solution. I just had my heart set on the d12.

You could roll the d12 for the 50/50 :D I keed I keed.


Pseudos wrote:

We can get REALLY close to how you want this to work (143/144):

1. Roll 2d12, we need to know which is which. Reroll if both are 12.
2. If the second die is less than or equal to the first die, add one to the first die for your result, otherwise use the first die.

A roll of double twelve would give 14; reroll in this case for perfect probability, or stay at 13 for a good estimate.

I even made a table for you. Green is the first die, blue the second.

EDIT: for 1-26:
1. Roll 3d12, we need to know which are which. Reroll if dice one and two are twelve.
2. If the second die is less than or equal to the first die, add one to the first die for step 3, otherwise use the first die for step 3.
3. Double what you have; if the third die is even, subtract 1.

I'll try this method and see how well it works at the table. I already have the table broken down into 2 columns. One is offensive spells and the other is defensive. Both have 13 spells in them.


Exact Method

For 13 possible results, roll (12 * (d12 - 1)) + d12 - 1(#). This gives you a random base 12 number from 0 ~ 0dBB (duodecimal, = 0 ~ 143 decimal). Reroll any result of 0. Then apply modulo 13 to the result, but treat 0 as 13.

(#)Can be simplified to (12 * d12) + d12 - 13.

For 26 possible results, roll (144 * (d2 -1)) + (12 * (d12 - 1)) + d12 - 1(#). This gives you a random base 12 number from 0 ~ 0d1BB (duodecimal, = 0 ~ 287 decimal). Reroll any result of 0 or 0d1BB (= 287 decimal). Then apply modulo 26 to the result, but treat 0 as 26.

(#)Can be simplified to (144 * d2) + (12 * d12) + d12 - 157.

In either case, if you don't have a modulo button on your calculator, divide by 13 or 26 as appropriate, take only the remainder, and multiply it by 13 or 26 as appropriate.

Alternate Exact Methods not using d12s (some of these are easier)

For 13 possible results, roll d14 (these do exist here and here) or (4 * (d4 - 1)) + d4 - 1(#). This gives you a random number from 1 ~ 14 or 0 ~ 15, respectively. Reroll results of 0 or 14 ~ 15.

(#)Can be simplified to (4 * d4) + d4 - 5. Not needed if you have an actual d14.

For 26 possible results, roll d30 (these do exist here and here) or (10 * (d3 - 1)) + d10 - 1(#). This gives you a random number from 1 ~ 30 or 0 ~ 29, respectively. Reroll results of 0 or 27 ~ 30.

(#)Can be simplified to (10 * d3) + d10 - 11. Not needed if you have an actual d30.


Bob_Loblaw wrote:
Pseudos wrote:

We can get REALLY close to how you want this to work (143/144):

1. Roll 2d12, we need to know which is which. Reroll if both are 12.
2. If the second die is less than or equal to the first die, add one to the first die for your result, otherwise use the first die.

A roll of double twelve would give 14; reroll in this case for perfect probability, or stay at 13 for a good estimate.

I even made a table for you. Green is the first die, blue the second.

EDIT: for 1-26:
1. Roll 3d12, we need to know which are which. Reroll if dice one and two are twelve.
2. If the second die is less than or equal to the first die, add one to the first die for step 3, otherwise use the first die for step 3.
3. Double what you have; if the third die is even, subtract 1.

I'll try this method and see how well it works at the table. I already have the table broken down into 2 columns. One is offensive spells and the other is defensive. Both have 13 spells in them.

If you want to try Pseudos method and you don't have the table handy then you can try this instead:

Roll 3d12

If they all give the same result (e.g. all eights) then reroll and start again.

Otherwise if the two closest dice to you agree the result is: 13

Otherwise the result is what appears on the closest die (from 1 to 12).


Pseudos wrote:
You are rewording exactly what I have already said in my original post.

My apologies to Pseudos. I thought about adding "(elegant solution!)" or something like that since I didn't think getting the exact distribution would be so easy with two d12s and only a single reroll. I thought that specifically quoting you implied I was not attempting to take credit for it.


Bob_Loblaw wrote:
I think I just figured out a potential solution. I'm just going to roll 1d12 + (1d12/6) -1. I don't think that this will make a huge difference in the distribution. If it might, please let me know. I'm not really much into statistics.

The problem with this method is that you are only half as likely to roll a "1" than any other number from 2..12 (plus it still generates a 13 at equal probability to the 1).

Pseudos's solution shouldn't need a table. Just like iterative attacks, one d12 is "primary". The other one determines whether or not to add one to your primary - add one to the primary if the secondary is at least as big as the primary (and reroll if you get two 12s).

*** edit ***
If the secondary is less than or equal to the primary, add one. My incorrect "at least as big as the primary" is completely wrong and makes it impossible to roll a 1 (among other probems).


ForkOfSpite wrote:
Bob_Loblaw wrote:
I think I just figured out a potential solution. I'm just going to roll 1d12 + (1d12/6) -1. I don't think that this will make a huge difference in the distribution. If it might, please let me know. I'm not really much into statistics.

The problem with this method is that you are only half as likely to roll a "1" than any other number from 2..12 (plus it still generates a 13 at equal probability to the 1).

Pseudos's solution shouldn't need a table. Just like iterative attacks, one d12 is "primary". The other one determines whether or not to add one to your primary - add one to the primary if the secondary is at least as big as the primary (and reroll if you get two 12s).

I am going to try this out and see how well it works for me. I wish I could remember all the statistics stuff I learned.


2 people marked this as a favorite.

@Bob_Loblaw

To be clear, there are only 2 steps.
1. Roll 2d12. Reroll if both are 12.
2. If Die2<=Die1, use Die1+1, otherwise use Die1.
That's it. It's die1 or die1+1.

@ForksOfSpite
With the phrase 'elegant solution!' I now understand what you meant, sorry about that.

For those logically inclined, I actually came up with an algorithm to let you turn any dice into evenly weighted distributions for other numbers, using a minimum number of rolls, at the cost of additional rerolls. (a generalized solution if you will)
Wall of text incoming.

I am a logician, not a statistician, so my terms may be off.
For dice 'D' rolling between between one and 'd', to get an even distribution in a desired range of numbers with result 'A' between 1 and 'r':
1. Determine the minimum whole number of dice 'N' such that r<=d^N, or N>=Log base d of r. The number of outcomes, d^N, is 'X'. (you can use a larger N if you wish)
2. Determine the unique number rolled Y;
Y=D1 + d*(D2-1) + d^2*(D3-1) + d^3*(D4-1) + d^4(D5-1) ... etc.
(generally y=1, for each Dx: Y+=d^x*(Dx-1) )
This number is unique for the set of dice we're using, so we have even distribution. Note that 1<=Y<=X.
3. Determine the range of numbers that are usable/unusable to keep even distribution. The increment, I, is the whole number of X/r; the remainder is our unusable space, U.
4. For every increment I our Y is, add one to A. The U highest numbers result in a reroll. (Simply, if Y<=X-U, A=RoundDown(Y/I), otherwise reroll) We have an answer! It's just not remotely elegant...
5. (epilogue) To minimize the number of rerolls, we want to minimize U; in step 1, instead of finding the minimum N, consider minimizing D^N%R against the difference between the current and minimum N. (% 'modulus' is remainder)

Let's do some examples:

Our example:
Die size 12 rolling between one and 12, for numbers between 1 and 13
D=12, d = 12, r = 13.
1. 13<=12^2=144; N=2, X=144
2. D1=3, D2=6; so Y=3+12*(6-1)=3+12*5=3+60=63=Y.
3. 144/13 rounded down is 11=I, remainder U=1
4. so D1=12, D2=12 needs rerolled, and each 11 possibilities we increment 1. Our Answer, A, if not {12,12}, =RoundDown((D1+12*(d2-1))/11) That's terribly complicated though!
5. U is 1, we are already optimized
For two dice, we can easily make a table, note patterns, and extrapolate. In this case, I noticed we had the D1 +1s showing up for each possibly in D1. I therefore moved the increments to the top of each column, and simplified the formula.

Die size 3 rolling between one and 3, for number between 1 and 13
D=3, d=3, r=13.
1.13<3^3; N=3, X=27
2. D1=2, D2=3, D3=1; so Y=2+3*(3-1)+3^2*(1-1)=2+3*2+3^2*0=2+3*2+9*0=2+6=8=Y
3. 27/13 rounded down is 2=I, remainder U=1
4. So if {3,3,3} reroll, otherwise A=RoundDown(Y=D1+3*(D2-1)+3^2*(D3-1)

Let's do an actual useful application; maybe you're a barbarian wielding a greataxe, and got to session without a d12. You can avoid the bell curve of 2d6 using 2d6 by:
1. roll 2d6
2. divide D2 by 3, round up; A= d1*d2.
There are numerous ways to solve the above problem, and making a table help identify solutions.

Let me know if you have any questions.


Pseudos wrote:

@Bob_Loblaw

To be clear, there are only 2 steps.
1. Roll 2d12. Reroll if both are 12.
2. If Die2<=Die1, use Die1+1, otherwise use Die1.
That's it. It's die1 or die1+1.

Sorry about taking so long to respond. The site is not always available regardless of browser for me.

Anyway, that's pretty much how I wrote it out on the table that I'm using. Thanks for figuring it out for me. It's been a very long time since I've had to do any stats or probabilities and was confusing myself.


Aren't there dice sites that will let you pick imaginary sided-dice?


bitter lily wrote:
Aren't there dice sites that will let you pick imaginary sided-dice?

I use rolz myself

Community / Forums / Pathfinder / Pathfinder First Edition / Homebrew and House Rules / Statistics Question All Messageboards

Want to post a reply? Sign in.
Recent threads in Homebrew and House Rules