Skip to content

Instantly share code, notes, and snippets.

@orrymr
Created September 13, 2021 17:58
Show Gist options
  • Save orrymr/adf295dcd6b30833118ea16a9ed6c010 to your computer and use it in GitHub Desktop.
Save orrymr/adf295dcd6b30833118ea16a9ed6c010 to your computer and use it in GitHub Desktop.
#roll, as in roll di(c)e
# m = number of times
# n = number of dice
roll <- function(m, n){
set.seed(1234)
means <- plyr::ldply(1:m, function(x){
return(mean(sample(1:6, n, replace = TRUE)))
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment