# it takes several seconds if 'redraw = TRUE'
buffon.needle(nmax = 500, interval = 0)
# this will be faster
buffon.needle(nmax = 500, interval = 0, redraw = FALSE)
# create HTML animation page
ani.start()
buffon.needle(saveANI = TRUE, nmax = 100, interval = 0.05,
width = 600, height = 600, redraw = FALSE)
ani.stop()
Run the code above in your browser using DataLab