R/test_event.R

#' Determine whether or not an event will take place
#' @param probability The probability of an event occurring
#' @param num_samples The number of events to check for (default is 1)
#' @return A logical, whether or not the event takes place
test_event <- function(event_prob, num_samples=1)
{
  return(runif(num_samples) <= rep(event_prob, num_samples))
}
sams25/rcombinator_old documentation built on May 28, 2019, 8:40 a.m.