Skip to content

expectopatronum/alea

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ade4b82 · Aug 28, 2018

History

12 Commits
Aug 28, 2018
Aug 28, 2018
Aug 28, 2018
Aug 3, 2018
Aug 28, 2018
Aug 28, 2018
Jul 30, 2018
Aug 28, 2018
Aug 28, 2018
Aug 28, 2018
Jul 31, 2018

Repository files navigation

... 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).

  • sides: can either be an integer value (maximum value on a standard dice) or a vector of sides. 6 and 1:6 both result in casting a 6-sided dice.
  • n_tries: how often the dice should be cast.
  • sum: whether the result of casting the dice should be summed.

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()
#> [1] 2
cast_dice(20, 3)
#> [1]  5 15 11
cast_dice(c(2, 4, 6, 8, 10))
#> [1] 8
d20()
#> [1] 19
d6(4, TRUE)
#> [1] 14

About

R package for casting dice.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages