Write a method called randomWalk that performs steps of a random onedimensional walk. The random walk should begin at position 0. On each step, you should either increase or decrease the position by 1...


Write a method called randomWalk that performs steps of a random onedimensional walk. The random walk should begin at position 0. On each


step, you should either increase or decrease the position by 1 (each with


equal probability). Your code should continue making steps until a


position of 3 or 23 is reached, and then report the maximum position


that was reached during the walk. The output should look like the


following:


position = 1


position = 0


position = –1


position = –2


position = –1


position = –2


position = –3


max position = 1



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here