In the steps variable, any draws that are a 1 stay a 1 and anything other than a 1 turns into a -1 with the use of Numpy's where function.
What is this a 1 stay a 1 etc? You may want to clarify the description. Also the image you have used in the beginning lacks license information. Are you sure if it is free to use?
A #steemstem mentor @dexterdev
I have removed the first image. The other images were generated in Python.
From here:
I randomly generate 0s and 1s with numpy's random.randint. Any ones stay a one which represent up jumps in the random walk. Anything other than a 1 in numpy's where function (i.e 0) turns into a -1 for a down jump. The
where()function is like an if-else statement.