Skip to content

abelsiqueira/DiceRolls.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DiceRolls.jl

This package defines dice and operations with them.

MPL-2.0 License GitHub Travis CI Coveralls Documentation Documentation


This package defines dice and some operations with them. We recommend looking into the docs for a better description of what you can do. As a simple example, here is the distribution of the tradicional ability score roll on Dungeons and Dragons, i.e., rolling 4 six-sided dice, removing the lowest and summing the result.

v, f = DiceRolls.histogram(drop(4d6), normalize=true)
Plots.bar(v, f, size=(400,300), leg=false)
xticks!(v)

Another example is to roll two four-sided dice, subtract 1 from each, and multiply the result.

v, f = DiceRolls.histogram((1d4 - 1) * (1d4 - 1))
Plots.bar(v, f, size=(400,300), leg=false)
xticks!(v)

This example can be found in the examples folder.