DndDice/R/roll.R

17 lines
343 B
R
Raw Normal View History

2019-03-19 03:56:07 +00:00
#'
#' Roll a die.
#'
#' Description.
#'
#' @param x A die to roll.
#' @param times How many times the die should be rolled.
#' @return A numeric vector representing the die rolls.
#' @examples
#' roll(d20)
#' roll(d20, times=10)
#'
#' @export
roll <- function(x, times=1){
return(sample(x$numbers, size=times, replace=TRUE, prob=x$probs))
}