Use the simOneIteration() function defined in the previous exercise, write a program to simulate n iterations, in which the drunken man always starts from the same position. Estimate the probability that the man returns home safely.
Input the initial position and number of iterations (p, n) -- 3, 10000
Probability:
Home 6949 69.5%
River 3051 30.5%
Input the initial position and number of iterations (p, n) -- 6, 20000
Probability:
Home 8026 40.1%
River 11974 59.9%