knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

... iacta alea est

-- Gaius Julius Caesar

alea

R package for casting dice, including dice for Dungeons & Dragons and special dice like the Sicherman dice.

Overview

alea consists of one main function cast_dice() with parameters for different situations (see below) and several dice like d4(), d20(), sicherman() which can be used without additional parameters. The interface for the main function is cast_dice(sides = 1:6, n_tries = 1, sum = FALSE).

Installation

You can install alea from github with:

# install.packages("devtools")
devtools::install_github("expectopatronum/alea")

Load the package:

library(alea)

Other packages

Since casting dice is a rather important and easily programmed task, there exist a few other R package. I made a list of the ones I found and tried a few examples here.

Examples

These examples show the usage of some of the dice in the package.

set.seed(24) # this seed was randomly chosen by casting a d60
cast_dice()
cast_dice(20, 3)
cast_dice(c(2, 4, 6, 8, 10))
d20()
d6(4, TRUE)


expectopatronum/alea documentation built on May 17, 2019, 1:04 p.m.