n <- 1000
trials <- rep(0, n)
for(i in 1:n){
rnd <- sample(c(0:9),10000, replace=TRUE)
count <- length(rnd[rnd == 3])
trials[i] <- count
}
mu <- mean(trials)
sd <- sd(trials)
pnorm(931, mean=mu, sd=sd, lower.tail = TRUE)
## [1] 0.01505047