Probability tester with rerolling dice

TonyD1016

Board Regular
Joined
Nov 18, 2021
Messages
59
Office Version
  1. 365
Platform
  1. Windows
So my work continues on an Excel probability calculator. A friend has asked me if I can simulate rerolls along with simulated roll sets.
Here's what I've done to accommodate that:
prop calc.xlsx
ABCDEFGHIJKLMN
1Tests10
2Rerolls3
3
4
5MissesRR AllowReroll ArrayRR ResultAdj Wins
621223142231226
733223151112116
812212342213226
933133142223126
1032133251133126
1113133342213326
1211111215321323
1331222142232236
1433333151133236
1511323342211315
16
17
18
reroll test
Cell Formulas
RangeFormula
A6:F15A6=RANDARRAY($B$1,6,1,3,TRUE)
G6:G15G6=MMULT(--(A6#>1),SEQUENCE(COLUMNS(A6#),,,0))
H6:H15H6=6-G6#
I6:I15I6=IF(6-G6#<=$B$2,6-G6#,$B$2)
J6:L15J6=IFERROR(RANDARRAY($B$1,$B$2,1,3,TRUE),0)
M6:M15M6=MMULT(--(J6#>1),SEQUENCE(COLUMNS(J6#),,,0))
N6:N15N6=IF(I6#<=M6#,I6#,M6#)+G6#
Dynamic array formulas.


The RANDARRAY generates an array of B2 number of sets of rolls of 6 three-sided dice, counting all rolls that aren't 1's as a win. The MMULT then counts the wins on each row.
In order to simulate rerolls I created a second RANDARRAY that rolls the same number of sets as B2, but with B3 columns for the number of rerolls I want to allow.

The trouble I was having was I only wanted to reroll ones in each test-- so if I had three total rerolls available, but a given test only had one miss, I only wanted to count one of the rerolls. Likewise if I had four misses on the test but only three rerolls available I only wanted to reroll three times. The solution I arrived at was to create some helper columns to count the number of misses, and compare that to the total number of permitted rerolls and then compare the number of hits on the reroll array to the number of misses in the original array and add whichever number is lower to get the adjusted result (with some error handling if the initial test had no rerolls available).

However, my concern is that my solution skews the probability too much. For instance, if a particular test had only one miss, it may only add a single win from the reroll array, but it's still effectively rolling three dice even though it should be only rolling one. As can be seen in Row 8, it correctly counted counted wins, but you can see the first test was a 1, so if this test had been done by hand that reroll would have only added a single win, not two.

Mathematically a reroll is identical to "Roll two dice but only count it once even if they both hit." Is there another solution that could better achieve what I am trying to accomplish?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
One way:

ABCDEFGHIJKLMN
1Tests10
2Min1
3Max3
4Rolls6
5Rerolls3
6
7RollsWinsRerollsWinsTotal
8311212311314
9322331513305
10111133223124
11312112311103
12212311312225
13113332433226
14212222533316
15123213433126
16323232622106
17312123413215
Sheet3
Cell Formulas
RangeFormula
A8:F17A8=RANDARRAY(B1,B4,B2,B3,TRUE)
G8:G17G8=MMULT(--(A8#>1),SEQUENCE(COLUMNS(A8#),,,0))
I8:K17I8=RANDARRAY(B1,B5,B2,B3,TRUE)
L8:L17L8=MMULT((I8#>1)*(SEQUENCE(,COLUMNS(I8#))<=(B4-G8#)),SEQUENCE(COLUMNS(I8#),,,0))
N8:N17N8=G8#+L8#
Dynamic array formulas.


Edit
G8:
=MMULT(--(A8#>1),SEQUENCE(B4,,,0))
L8: =MMULT((I8#>1)*(SEQUENCE(,B5)<=(B4-G8#)),SEQUENCE(B5,,,0))
 
Last edited:
Upvote 0
Solution

Forum statistics

Threads
1,216,081
Messages
6,128,696
Members
449,464
Latest member
againofsoul

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top