dice distributions - probabilities of dice rolls


Dice distributions - probabilities of dice rolls

var diced = require('diced')
var d = diced('2d6')
for(var i=0; i < d.length; i++){
  var roll = i + d.low
  console.log('Roll a %d: %d%', roll, (d[i] * 100).toFixed(2))


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%

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 

The result of diced is an Array-like object.

The probability of a roll n, where n=0 is the probability of the lowest possible roll

The lowest possible roll

The highest possible roll

The number of dice in the distribution set

The number of sides for a single die