Source: https://www.cs.otago.ac.nz/cosc453/student_tutorials/monte_carlo.pdf