and @Bill ZebubWorking out a formula is a bit more time than I want to invest.I mean, for values from 1 to R, each value will occur R times; for values from R+1 to N, each value will occur N+R times, over a total population of values that's N^2. I'm sure it could be calculated from that, but seems much easier just to do analytically.
Ok, it was either this or do work I was supposed to do...
I think the easiest way to get the variances is to view it as a mixture distribution, where you have an R/N chance of having a discrete uniform from 1 to N (you rolled 1 to R the first time), and a 1-(R/N) chance of having a discrete uniform from (R+1) to N (you rolled a keeper the first time). That the mixture pretends you reroll the dice for keepers (to decide which keeper) doesn't matter since they have an equal probability either way.
So, putting the means and variances of the discrete uniform into the formulas for a mixture distribution I got:
m1=(1+N)/2
v1=(N^2-1)/12
w1=R/N
m2=(R+1+N)/2
v2=((N-R)^2-1)/12
w2=1-(R/N)
mmix=w1m1+w2m2
vmix=w1(v1+m1^2)+w2(v2+m2^2)-mmix^2
Insert algebra.
The mean comes out to be (RN+N+N^2-R^2)/2N, matching what you found.
The variance comes out to be gross, but just what you get by plugging things in. So we can calculate it pretty quickly for any given N and R. (I plopped those formulas right into R, and added taking a square root).
And the standard deviations are not what I was expecting!
It looks like when you get to rerolling the lowest half of the possible values that the variances start going up again, and can be larger than not dropping anything!
This seemed odd, so I calculated them out by getting the distributions in the d4 case, and they do look to be right.
Anyway, here are what I get for the ratios of the standard deviations for dropping 1s (and keeping the reroll) to the standard deviations of just keeping, for d3 to d100.
Last edited: