oopt = ani.options(interval = 0.2, nmax = 100)
# should be close to 1/6
MC.hitormiss()$est
# should be close to 1/12
MC.hitormiss(from = 0.5, to = 1)$est
## HTML animation page
ani.options(interval = 0.5, title = "Hit or Miss Monte Carlo Integration",
description = "Generate Uniform random numbers and compute the proportion
of points under the curve.")
ani.start()
MC.hitormiss()
ani.stop()
ani.options(oopt)
Run the code above in your browser using DataLab