Question: markov processes in maple14

I have to answer the following question:

simulate a modified simple random walk starting at 0 which at each step, in addition to possible unit jumps to the right (with probability p) and to the left (with prob q), may stay at its current position with probability r>0, so that p+q+r=1. We have been given the hint to type in

if (u<p) then x:=1 else if (u<p+q) then x:=-1 else x:=0 fi; fi;

and to rename the procedure, but i have no idea how to carry out the simulation?

Thankyou!!

Please Wait...