Skip to content

Instantly share code, notes, and snippets.

@josephdunn
Created February 24, 2015 16:17
Show Gist options
  • Save josephdunn/02ff184e3cbd957e4c62 to your computer and use it in GitHub Desktop.
Save josephdunn/02ff184e3cbd957e4c62 to your computer and use it in GitHub Desktop.
winProb <- 0.525
numBets <- c(1, 50, 1000, 10000, 100000)
runTimes <- 1000
pl <- function(bets)
{
sum(rbinom(bets, 1, winProb) - 0.5)
}
runs <- do.call(rbind, lapply(1:runTimes, function(x) { sapply(numBets, pl) }))
summary(runs[,2]) # etc...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment