n <- 100 support <- 1:n walk <- cumsum(2*rbinom(n,1,0.5)-1) graph <- function(k) { plot(1:k, walk[support<=k], xlim=c(1,n), ylim=c(-n/10,n/10), type="l") Sys.sleep(0.1) } ignore <- sapply(support, graph)