Results 1 to 25 of 25
Thread: Dice Math

20210616, 10:22 PM (ISO 8601)
 Join Date
 Jul 2016
 Gender
Dice Math
I'm trying to calculate some dice probabilities, and I'm having some trouble.
So let's see if I can spell it out here for y'all, and hopefully maybe some of y'all can help me out:
 There is a pool of dice, ranging in size from d4 to d12, not to exceed 8 dice.
 These dice are rolled all at once
 Query: What is the probability that any of the dice will land on the same number? What is the probability that some of the dice will each land on a 1?
So let's take a hypothetical pool: 2d4, 1d6, 3d8, 1d10, 1d12. We roll the entire pool. What is the probability that any two dice will land on the same number? What is the probability that any two dice will land on a 1?

20210616, 10:31 PM (ISO 8601)
 Join Date
 Aug 2007
 Location
 Imagination Land
 Gender
Re: Dice Math
The different die sizes are really going to complicate this.

20210616, 11:34 PM (ISO 8601)
 Join Date
 Oct 2007
Re: Dice Math
The 1s case seems simpler to calculate, so let's start with that.
Odds of having no ones is easy, you just multiple all the odds for each die to not to roll a '1' together. So 3/4 * 3/4 * 5/6 ...
For the given example, it's ~25.9%
The odds of having exactly one '1', could I think be calculated by:
1) Calculate for each die. For example, the odds of only the first d4 being '1' are 1/4 * 3/4 * 5/6 ...
2) Add them together. I think this is correct, but not 100% sure.
If step two is correct, the total is ~38.8%
So combining those, the odds of having two or more '1's is ~35.3% for the example pool given.
For the 'any two match' case, I'm sure there's a formula, but I'd be tempted to brute force it. Only about six million combinations, so shouldn't be too bad.
Edit: Just did that with a script.
The odds at least two matching are quite high: 5840640 / 5898240 = 99.02%
The odds of at least two '1's are the same as above: 2082267 / 5898240 = 35.3%
Personally speaking, I don't think I'd enjoy this as a game mechanic  I dislike ones which obfuscate the actual odds.Last edited by icefractal; 20210617 at 12:20 AM.

20210617, 12:02 AM (ISO 8601)
 Join Date
 Oct 2011
Re: Dice Math
Call the number of dice n. For each die, call its range of values s.
The odds that a given die rolls a 1 is 1/s; the odds that it does not roll a 1 is (s1)/s.
The odds that no dice roll a 1 is found by multiplying all n of the (s1)/s values together.
The odds that exactly 1 die rolls a 1 is found by summing all n of the " n1 (s1)/s values times one 1/s value" together.
The odds that two of more dice roll a 1 is 1 minus the sum of the previous two values. Or… the product of all the s values, minus "the sum of all n of the ' n1 s1 values', and 1"… out of the product of all the s values.
So, for 3d6, the odds of 2+ 1s is (216((5*5*5)+(25+25+25))/216 = 216(125+75)/216 = 216200/216 = 16/216.

20210617, 04:20 AM (ISO 8601)
 Join Date
 Jul 2014
Re: Dice Math
No one linked this yet?
https://anydice.com/
My attempt at nonawful fumble rules
Arcane Archer minimal fix (maybe not so minimal anymore)
Reworking the Complete Adventurer Tempest PrC
Expanding the Pathfinder Called Shots system
Keyboard shortcuts for d20srd.org
Guide to Optimizing ToHit
Obscure Psionic Power Index
🕷

20210617, 04:41 AM (ISO 8601)
 Join Date
 Jun 2019
Re: Dice Math
Chance you roll 2 or more 1's:
Take each dice set of the same size and compute 2 values:
1. The chance or rolling exactly a single 1.
2. Calculate the chance of rolling no 1's.
***Binomial Distribution can solve these 2 questions.
1. Then simply multiply each terms chance of not having any 1's all together  this is your chance of not rolling any 1's.
2. Then take the case where one term has exactly a single 1, and each other term has no 1's and multiply together those probabilities, then repeat for the other cases where a different term has exactly a value of 1 and the other terms have no 1's and sum together the results  this is your chance of rolling only a single 1.
If you add those 2 probabilities together and then subtract that from 1 you get your answer. If you want to know the chances for any doubles, you just repeat this process for 2's, 3's, etc and sum together all the results.Last edited by Frogreaver; 20210617 at 05:08 AM.

20210617, 08:46 AM (ISO 8601)
 Join Date
 Oct 2011

20210617, 10:46 AM (ISO 8601)
 Join Date
 Jun 2019

20210617, 01:16 PM (ISO 8601)
 Join Date
 Jul 2016
Re: Dice Math
The 1 is easy. (1/4*1/4)+2*(1/4*1/6)+6*(1/4*1/8)+2*(1/4*1/10)+2*(1/4*1/12)+3*(1/6*1/8)+(1/6*1/10)+(1/6*1/12)+3*(1/8*1/10)+3*(1/8*1/12)+(1/10*1/12)
This is known as a permutation. I feel like I just did someone's homework for them lol.
Edit:whoops, forgot an important part.
(1/4*1/4*5/6*7/8*7/8*7/8*9/10*11/12)+2*(1/4*1/6*3/4*7/8*7/**7/8*9/10*11/12)+6*(1/4*1/8*3/4*5/6*7/8*7/8*9/10*11/12)+2*(1/4*1/10*3/4*5/6*7/8*7/8*7/8*11/12)+2*(1/4*1/12*3/4*5/6*7/8*7/8*7/8*9/10)+3*(1/6*1/8*3/4*3/4*7/8*7/8*9/10/11/12)+(1/6*1/10*3/4*3/4*7/8*7/8*7/8*11/12)+(1/6*1/12*3/4*3/4*7/8*7/8*7/8*9/10)+3*(1/8*1/10*3/4*3/4*5/6*7/8*7/8*11/12)+3*(1/8*1/12)+(1/10*1/12*3/4*3/4*5/6*7/8*7/8*7/8)
This is the probability that exactly 2 1s are rolled.AT LEAST 2 1s gets much much longer.Last edited by Calthropstu; 20210617 at 03:11 PM.

20210617, 01:46 PM (ISO 8601)
 Join Date
 May 2018
Re: Dice Math
For this given set, the probabilities are 35% for the double 1, and 99% for any double.
In general, here is the code I used, which you can copy in any Python interpreter (like this one: https://www.programiz.com/pythonpro...linecompiler/), and just modify the dice set by anything you want.
Code:########## # Set up # ########## dice_set = [4,4,6,8,8,8,10,12] # < INPUT HERE precision = 10000 ################ # Computations # ################ import random max_size = 12 def rolling_dice(): results = [0]*max_size double_one = False double_any = False for d in dice_set: r = random.randint(0,d1) results[r] += 1 if r == 0: one = True if results[r] > 1: double_any = True if r == 0: double_one = True break return (double_one,double_any) nb_double_one = 0 nb_double_any = 0 for i in range(0,precision): is_double_one,is_double_any = rolling_dice() if is_double_one: nb_double_one += 1 if is_double_any: nb_double_any += 1 ########### # Results # ########### print("Rolling a double 1:",nb_double_one/precision) print("Rolling any double:",nb_double_any/precision)
Last edited by MoiMagnus; 20210617 at 01:48 PM.

20210617, 02:07 PM (ISO 8601)
 Join Date
 Dec 2008
Re: Dice Math
Now that the math is solved, I’m curious about the game mechanics here. This sort of math isn’t particularly intuitive, which means it may not work as intended/be subject to abuse.

20210617, 03:13 PM (ISO 8601)
 Join Date
 Jul 2016

20210617, 04:03 PM (ISO 8601)
 Join Date
 Oct 2010
 Location
 Dallas, TX
 Gender
Re: Dice Math
Here is the solution of the general problem of probability of doubles with n dice. The example will be the hypothetical set from the first post: 2d4, 1d6, 3d8, 1d10, 1d12.
We are going to solve the complementary problem  the probability of no doubles. Then Prob (doubles) = 1  Prob (no doubles)
Put the dice in order, lowest to highest.
1d4
1d4
1d6
1d8
1d8
1d8
1d10
1d12
Assume the dice are rolled one at a time, lowest to highest. For each die, calculate the probability of no doubles, assuming that there were no doubles before it was rolled.
Assume that the ith die is a jsided die. So in the example,
The 1st die is a d4. i = 1, j = 4.
The 2nd die is a d4. i = 2, j = 4.
The 3rd die is a d6. i = 3, j = 6.
The 4th die is a d8. i = 4, j = 8.
The 5th die is a d8. i = 5, j = 8.
The 6th die is a d8. i = 6, j = 8.
The 7th die is a d10. i = 7, j = 10.
The 8th die is a d12. i = 8, j = 12.
Since the assumption of no doubles before it was rolled, for the ith die, there are i1 different numbers already rolled, any of which could be rolled on that die. So to not make doubles, it has to miss those i1 numbers.
Out of j possibilities, i1 cause doubles. So j(i1) =ji+1 do not cause doubles. The probability of this is (ji+1)/j.
If each of those rolls avoids making a double, then there is no double. [The first term can be ignored, since it is always j/j = 1.]
So Prob (no doubles) = the product of that quantity for every value of i.
= (41+1)/4 * (42+1)/4 * (63+1)/6 * (84+1)/8 * (85+1)/8 * (86+1)/8 * (107+1)/10 * (128+1)/12
= (4/4) * (3/4) * (4/6) * (5/8) * (4/8) * (3/8) * (4/10) * (5/12)
= 5 / 512 = 0.009765625
The general formula is the product, from 1 to n, of (ji+1/j)
Since this was the probabiity of no doubles, the probability of a double is just 1  0.009765625 = 0.990234375, or 1  5/512 = 507/512.Last edited by Jay R; 20210617 at 04:07 PM.

20210617, 05:55 PM (ISO 8601)
 Join Date
 Jul 2016

20210617, 10:00 PM (ISO 8601)
 Join Date
 Jun 2019

20210617, 10:59 PM (ISO 8601)
 Join Date
 Jul 2016
 Gender
Re: Dice Math
So the goal is to model the interactivity of various factions in a sandbox. This would be for a D&D game driven by the interactions of these various factions. My idea was to assign each of the eight factions a die size (d4  d10) based on their power (inverse curve, so more powerful factions get a lower die size). Each ingame month, I roll the pool of dice. For every double that isn't a one, that represents a point of conflict between those factions. The higher the number, the more invested the factions are in getting their way (e.g., the less tractable they are to alternative solutions or compromise). So if three factions roll an 8, for example, then there are three (relatively small) factions that are very invested in a given point of conflict.
Maybe a powerful faction has a daughter coming of marriageable age, and all three factions are interested in this young lady. Maybe one faction is a powerful wizard, another is a local templecommandery (paladin order), and the last one is another noble house. The paladins want to recruit this noblewoman, because they've seen her fight and they think that recruiting a powerful knight and getting an alliance with her family is a good deal. The wizard doesn't want to marry the young lady, but he definitely doesn't want the paladins or the noble family to add her to their forces, because the young lady in question hates this wizard, and will likely agitate to get him killed. The noble family wants to bring this young lady inhouse because their heirdesignate kind of sucks, and they think having her on board might save their house. And so on.
For every 1 in common with multiple factions, those are factions that have gotten into an armed conflict, either through misunderstanding, random chance, ambush, personal issues, etc. So let's say I get natural 1's on a d4, a d6, and a d10. So maybe a rampaging heathen army (d4) is waylaid by a sneaky noble house (d6), and the battle accidentally swept up a handful of traveling sorceress' apprentices (d10). Now I need to figure out the result of the armed conflict, how each faction feels about it, and then figure out how that clash changes the landscape.
So, I'm looking for a system that will generate at least one interesting event once per month that pulls in multiple factions and that the PCs can hear about as it starts to change and evolve the struggle between the factions. Sounds like this actually delivers pretty much what I want.

20210618, 07:05 AM (ISO 8601)
 Join Date
 Jun 2019
Re: Dice Math
What's wrong the rolling a percentile dice to determine if such an event occurs and then rolling a d6 or whatever for however many factions you have to determine how many are involved?
Your dice method just seems a bit overly complicated for what you are trying to acheive.Last edited by Frogreaver; 20210618 at 07:06 AM.

20210618, 07:50 AM (ISO 8601)
 Join Date
 May 2018
Re: Dice Math
His method has the following advantages:
(1) Different factions have different likelihood of being involved. Evil empires get small dice, pacifist city states get big dice.
(2) He has additional information that he didn't initially planned to use, but that might inspire him. Percentile tables usually require you to plan much more, and fill in advance what happen in which range. Here, you can improvise some meaning for each number as you go.
The lowest the results are the more aggressive the event might be, etc. Maybe the result obtained by each faction is "stored" to be used later for something else.
(3) Alternatively, if he fill up the table for "what happen in which case", then there is naturally a set of modifiers that the PCs could trigger. If the PC are gaining influence over a faction, maybe they get a reroll for their faction die? Or maybe they can force a +/1?
In general "rolling a die for each faction and improvise a way to interpret the results" is not the worst way get ideas, and require far less preparation time than writing a full percentile table.
If you find yourself using this method often, it's reasonable to ask peoples on the internet what are the actual probabilities of the events you were using.

20210618, 09:14 AM (ISO 8601)
 Join Date
 Jun 2019
Re: Dice Math
Last edited by Frogreaver; 20210618 at 09:14 AM.

20210618, 09:57 AM (ISO 8601)
 Join Date
 Dec 2008
Re: Dice Math
It’s kind of a cool idea, but some of the implications for powerful factions feel a bit off. Since they only roll a d4, they can’t be overly invested in any conflict. And a full quarter of their conflicts will be armed. So the most powerful actors in your setting are simultaneously less invested in their conflicts and more likely to get violent about them.
It seems like you might want to divorce faction power from both level of investment and likelihood of violence. Otherwise, there’s no scenario where a powerful faction could use diplomacy or subterfuge to pursue an important goal.
You also have the odd result that any given conflict is equally important to all participants. So you couldn’t have something like a mining consortium whose new claim (profitable, but not going to make or break them) threatens the livelihoods of a bunch of farmers (literally life and death).
As a quick fix to both of those, maybe make the power/die size relationship direct rather than inverted, but also make the level of investment based on the ratio of conflict number to die size. So maybe that mining consortium rolls a 4 on a d8 and the farmers roll it on a d4. Now that’s of moderate importance to the consortium (4/8), but critical to the farmers (4/4). And your most powerful factions can have a wide variety of conflicts, but only conflicts with other powerful factions can represent an existential threat. As for armed conflict, you might want to just roll that separately or make it a judgment call as to how the conflict should play out.

20210618, 05:01 PM (ISO 8601)
 Join Date
 Oct 2011
Re: Dice Math
Well. I was just coming back to try it this way. My intuition failed me, and told me that my original halfanswer would be *easier* than this, and thus a good leadin to this. This is, indeed, the elegant solution to the problem. Kudos!
However,it looks like we've solved the wrong problem.

20210618, 10:00 PM (ISO 8601)
 Join Date
 Jul 2016
 Gender
Re: Dice Math
I hear you! I have a few problems with your solution. 1) My style is more "play to see what happens," so I want a system that damn near guarantees something is going on every month, and does so in a way that will spark my creativity to explain stuff what's going on. Furthermore, I frequently have literally five minutes of prep time for a daily 1:1 game, so anything that saves me time and rolls is valuable.
I probably missed something in my explanation. So, let's consider a d4 faction and a d8 faction both get a 4 on a pool roll. That d4 faction really cares about whatever that conflict is, while the d8 faction is less invested.
To me, it seems that the more powerful you are, the more conflicts in which you would be embroiled. And if you've got a lot of power, you're probably not shy about throwing it around. In a medievalistsetting, armed force is a popular means of solving problems (but still not the only one!). So to me, at least, it made sense! :)
How so?

20210619, 08:49 PM (ISO 8601)
 Join Date
 Dec 2008
Re: Dice Math
This doesn't really make sense to me. So if you have the local duke (d4) in conflict with some bandits (d8), the duke is more invested in that than the bandits are? It seems more likely that the bandits are an annoyance to the duke, but the duke is an existential threat to the bandits. More generally, a powerful faction can make or break a weak one, but a weak faction usually isn't a threat to an entrenched power, so you'd think a conflict between them is a much bigger deal to the weaker faction. There are exceptions to that, but your system is *always* going to have the powerful faction more invested in the conflict than the weaker one.
I get the thought process behind giving powerful factions smaller dice to make them involved in more conflicts, but the "level of investment" mechanic seems screwy to me. A powerful faction can usually bring more resources to a conflict, but a weaker faction is much more likely to care deeply about the result.

20210619, 09:43 PM (ISO 8601)
 Join Date
 Jul 2016
Re: Dice Math
Not 100% maybe? The "bandits" could be a tool for someone much more powerful. Maybe they have an ally in the other dice. Maybe they count the Duke's cousin amongst their number.
But most likely, the bandits just nabbed a close family member of the duke, artidicially boosting their importance.

20210620, 05:43 AM (ISO 8601)
 Join Date
 Dec 2008