If given a numeric vector, d()
creates an object of the Dice S4 class
representing a die with these values for faces. On the other hand, if given
a numeric scalar, it creates a die with faces running from 1 to this value.
At the moment, there is no support for specifying each face's probability,
although it is possible to create a die where more than one face have the
same value.
This function has two main purposes: creating non-standard dice and allowing
for interactive dice rolling. Non-standard dice are arbitrary objects that
might not have a real world counterpart, e.g., a d(17)
or a
d(c(1, 1, 3))
. Interactive rolling is the ability to get a random result
from a die without having to resort to functions of the roll family,
explained in detail in the documentation for the Dice S4 class.