result<-sample(1:6,10000,replace=TRUE)
f=c(1:10000)
for (i in 1:10000)
f[i]<-length(which(result[1:i]==6))/i
plot(1:10000,f,type='o',col='red',log="x")
line(c(1,10000,c(1/6,1/6),lty=3))
result=sample(c(0,1),10000,replace=TRUE)
n=cumsum(result)
f=n/1:10000
plot(1:10000,f,type='o',col='red',log="x")
line(c(1,10000,c(0.5,0.5),lty=3))
result = sample(1:3,10000,replace=TRUE)
f = c(1:10000)
for (i in 1:10000)
f[i] = length(which(result[1:i]==1))/i
plot(1:10000,f,type='o',col='red',log="x")
line(c(1,10000,c(1/3,1/3),lty=3))