Skip to content

Instantly share code, notes, and snippets.

@tony91782
Created May 31, 2011 04:10
Show Gist options
  • Save tony91782/999843 to your computer and use it in GitHub Desktop.
Save tony91782/999843 to your computer and use it in GitHub Desktop.
secretnum = 1:10
stop = 150
faceval = round(floor(13*runif(stop))+0.999)
faceval = pmin(10,faceval)
data = secretnum
draws = 1:stop
for(i in draws){
secretnum = secretnum -1
secretnum = ifelse(secretnum==0, faceval[i],secretnum)
data=cbind(data, secretnum)
}
draws = c(draws, stop+1)
plot(draws, data[1,], type="l")
for(k in 2:10){
lines(draws, data[k,], type="l")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment