You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varnormalizedRoll=(diceCorpus[index]+1)/maxDiceRoll//its the sequence thats random, not the number. normalize the sequence for use by any diceresult=Math.ceil(normalizedRoll*finalDiceSize);
Because normalizedRoll is quantized to 32 possible values, if finalDiceSize doesn't divide evenly into 32, then rounding up biases the result
Let's do 1000000 rolls and look at a histogram
d8 divides 32 evenly, so it is uniform:
but d10 does not evenly divide 32. Values of 5 and 10 are more likely:
nor does d20 evenly divide 32
even if we query the quantum computer every roll, instead of cacheing, we still have quantization error. what can we do? hmm.
one way to address this is to just ignore all values larger than finalDiceSize. for example..
These lines produce a quantization/rounding error
Because
normalizedRoll
is quantized to 32 possible values, iffinalDiceSize
doesn't divide evenly into 32, then rounding up biases the resultLet's do 1000000 rolls and look at a histogram
d8 divides 32 evenly, so it is uniform:

but d10 does not evenly divide 32. Values of 5 and 10 are more likely:

nor does d20 evenly divide 32

even if we query the quantum computer every roll, instead of cacheing, we still have quantization error. what can we do? hmm.
one way to address this is to just ignore all values larger than
finalDiceSize
. for example..now look at results for d20:

Cool project 👍
Best,
CJ
The text was updated successfully, but these errors were encountered: