DndDice/R/roll.R
2019-03-18 20:56:07 -07:00

16 lines
343 B
R

#'
#' 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))
}