Reference

Contents

Index

Dices.CompactedComparisonType
CompactedComparison(r, op, x)

Stores a comparison between a roll r and a value x. Use collect to collect all the roll values that satisfy that comparison.

source
Dices.CompositeRollType

A CompositeRoll is a roll where its parts are rolls. This structure is usually used only internally.

source
Dices.DiceType
Dice(sides)

Dice is the basic structure of the package. It has sides. The traditionall RPG dices are predefined: d4, d6, d8, d10, d12, and d20. There is also an additional useful "dice": coin.

source
Dices.DiceRollType

A DiceRoll is an Roll made only of dices. A sum or product of several dices, for instance.

source
Dices.DropRollType

A DropRoll is a roll where some of the parts of the internal roll are ignored. See drop for more information.

source
Dices.KeepRollType

A KeepRoll is a roll where some of the parts of the internal roll are ignored. See keep for more information.

source
Dices.RollMethod
Roll(d :: Dice)

Create a Roll from a single Dice. Usually used internally.

source
Dices.dropMethod
drop(r)
drop(r; kind=:lowest, n=1)

Drops the lowest part of a roll. Notice that for a DiceRoll, this means dropping the lowest dice in a roll, but for composite dice, it can mean dropping a whole segment. For instance

drop(4d6)

will drop the lowest valued dice of the four 6-sided dices rolled. It is equivalent to

v = roll.([d6, d6, d6, d6])
sum(v) - minimum(v)

On the other hand,

drop((2d4 - 1) * (2d4 - 1))

will drop the lowest of the product, i.e., it is equivalent to

v = roll.([2d4 - 1, 2d4 - 1])
sum(v) - minimum(v)

keyword arguments

  • kind: Either :lowest or :highest to remove either the lowest or highest roll or rolls.
  • n: The number of dices to be removed.
source
Dices.histogramMethod
values, frequency = histogram(dice; normalize=false)
values, frequency = histogram(roll; normalize=false)

Computes the histogram of a dice or roll. This operation can be intensive because it computes the histogram of its internal parts recursively, so it can slow for complicated rolls.

source
Dices.keepMethod
keep(r)
keep(r; kind=:highest, n=1)

Keep only the highest part of a roll. Notice that for a DiceRoll, this means keeping the largest dice in a roll, but for composite dice, it can mean keeping a whole segment. See the behaviour of drop for more information.

keyword arguments

  • kind: Either :lowest or :highest to keep either the lowest or highest roll or rolls.
  • n: The number of dices to be kept.
source
Dices.probMethod
prob(comparison)

Compute the probability of the given comparison, e.g., prod(2d4 > 3).

source
Dices.rolllistMethod
rolllist(d :: Dice; generator=false)
rolllist(r :: Roll; generator=false)

Show all possible rolllist of dice d or roll r. For DiceRolls this is a list of all dice results. For CompositeRolls and other Rolls where its parts are made of Rolls.

source