dice v0.2.0 Dice View Source

Documentation for Dice.

Link to this section Summary

Functions

Returns the average roll of a d-sided dice rolled n times

Returns the maximum roll of a d-sided dice rolled n times

Returns the minimum roll of a d-sided dice rolled n times

Gets a list of a d-sided dice rolled n times

Returns the sum of a d-sided dice rolled n times

Link to this section Functions

Returns the average roll of a d-sided dice rolled n times.

Examples

iex> Dice.avg(10, 1000)
560

iex> Dice.avg("10d10")
560

Returns the maximum roll of a d-sided dice rolled n times.

Examples

iex> Dice.max(10, 1000)
914

iex> Dice.max("10d10")
914

Returns the minimum roll of a d-sided dice rolled n times.

Examples

iex> Dice.min(10, 1000)
49

iex> Dice.min("10d10")
49

Gets a list of a d-sided dice rolled n times.

Usage: Dice.roll(n, d)

Used to roll a d-sided dice n times, returning a list of the rolls. Supports either two numbers or one string.

Examples

iex> Dice.roll(10, 10)
[6, 10, 3, 6, 7, 1, 2, 9, 2, 4]

iex> Dice.roll("10d10")
[6, 10, 3, 6, 7, 1, 2, 9, 2, 4]

Returns the sum of a d-sided dice rolled n times.

Examples

iex> Dice.sum(10, 10)
52

iex> Dice.sum("10d10")
52