Diced
Dice distributions - probabilities of dice rolls
var diced =var d =forvar i=0; i < dlength; i++var roll = i + dlowconsole
Result:
Roll a 2: 2.78%
Roll a 3: 5.56%
Roll a 4: 8.33%
Roll a 5: 11.11%
Roll a 6: 13.89%
Roll a 7: 16.67%
Roll a 8: 13.89%
Roll a 9: 11.11%
Roll a 10: 8.33%
Roll a 11: 5.56%
Roll a 12: 2.78%
diced(diceString)
The notation for diceString is NdS
, where N
is the number of dice used and S
is
the number of sides each die has. Examples:
// two 6-sided die// three 12-sided die
var d = diced('2d6')
The result of diced is an Array-like object.
d[n]
The probability of a roll n
, where n=0
is the probability of the lowest possible roll
d.low
The lowest possible roll
d.high
The highest possible roll
d.quantity
The number of dice in the distribution set
d.sides
The number of sides for a single die