#' 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))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.