Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -




Not registered yet?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno

Go back

Topic review (newest first)

2008-03-17 23:59:21

Hi there,

I've been working on a programme that calculates the chance of success of rolling different sets of D6 (dice). I think I have it right but I am not a mathematician, I just enjoy maths, so I would be very grateful if someone can confirm my calculations are correct. The chance of success should be all of the dice getting at least the number required. For example:

Each of there can be re-rolled once if they fail: 2, 3, 4
One of these can be re-rolled if it fails: 2, 3 (e.g. I roll a 2, 2 & re-roll the second 2 as it failed)
One of these can be re-rolled if it fails: 4, 5
None of these can be re-rolled: 2, 3, 4

The result I get is a 5.417905044962658% probability that all of the above will succeed.

The tricky part, to explain as well as code, is when there is an extra re-roll that can be used only once but can be used by any of the "One of these can be re-rolled if it fails:" or "None of these can be re-rolled:" blocks. Also once a dice has been re-rolled it cannot be re-rolled a second time so the extra re-roll is only useful for the "One of these can be re-rolled if it fails:" blocks if two dice fail. The result I get when adding this extra re-roll to the rolls required about is: 11.869997092809927%.

I hope I explained that well enough. smile You can find the code here:, look for the calculate() function at the bottom as a starting point.

Many thanks

Board footer

Powered by FluxBB