N <- 10000
runCount <- 0
for(i in rnorm(N)){
if (i >= -1 & i <= 1){
runCount <- runCount + 1
}
}
ratio <- runCount/N
ratio
N <- 10000
runCount <- 0
for(i in rnorm(N)){
if (i >= -1 & i <= 1){
runCount <- runCount + 1
}
}
ratio <- runCount/N
ratio
with that using rnorm its expected to get a number between -1 and 1 68.2% of time
n=10 got .3
n=1000 got .693
n=100000 got .68099
n=10000000 got .6828726
n=1000000000 got .682669
with that using rnorm its expected to get a number between -1 and 1 68.2% of time
n=10 got .3
n=1000 got .693
n=100000 got .68099
n=10000000 got .6828726
n=1000000000 got .682669