code Link to heading
import random as rnd
repetition = 10
for r in range(repetition):
x = [0]
steps = 99
for s in range(steps):
dx = rnd.randint(0, 1) * 2 - 1
xnew = x[-1] + dx
x.append(xnew)
print(x)
url https://onecompiler.com/python/3zn74x3a5
result Link to heading
[0, -1, 0, -1, 0, 1, 2, 1, 2, 3, 4, 5, 4, 3, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 12, 13, 12, 11, 12, 11, 12, 13, 12, 11, 10, 9, 10, 9, 10, 11, 12, 13, 14, 13, 14, 13, 14, 15, 14, 13, 14, 13, 12, 13, 12, 13, 12, 11, 10, 9, 8, 9, 10, 11, 10, 9, 8, 9, 10, 9, 10, 11, 12, 13, 12, 11, 12, 11, 10, 11, 10, 11, 12, 11, 10, 11, 12, 11, 12, 13, 12, 13, 14, 15, 16, 15, 16, 15]
[0, -1, -2, -3, -4, -5, -4, -3, -4, -3, -4, -5, -4, -5, -6, -5, -4, -5, -6, -5, -4, -3, -2, -3, -4, -3, -4, -3, -2, -1, -2, -1, -2, -3, -2, -1, 0, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 0, 1, 2, 1, 2, 3, 4, 5, 4, 5, 4, 3, 4, 3, 2, 3, 4, 3, 4, 5, 4, 3, 2, 3, 4, 3, 4, 3, 2, 3, 4, 3, 2, 3, 4, 3, 4, 5, 4, 3, 2, 1, 0, -1, -2, -1, 0, -1, 0, -1, 0, 1]
[0, -1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 3, 2, 1, 0, -1, 0, -1, -2, -1, -2, -1, -2, -3, -2, -3, -2, -3, -4, -5, -4, -3, -2, -3, -4, -5, -6, -5, -4, -3, -2, -1, -2, -3, -4, -5, -4, -5, -6, -5, -4, -5, -6, -5, -6, -7, -8, -9, -8, -9, -10, -11, -12, -11, -12, -13, -12, -13, -12, -13, -12, -13, -12, -11, -12, -13, -14, -15, -16, -15, -14, -13, -12, -11, -10, -11, -10, -9, -8, -9, -8, -7, -6, -7, -8, -9, -10, -9, -8, -9]
[0, -1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 3, 2, 3, 2, 1, 2, 1, 0, 1, 0, 1, 0, -1, -2, -1, -2, -1, 0, 1, 0, -1, -2, -3, -4, -5, -6, -7, -6, -5, -6, -7, -6, -5, -4, -3, -2, -1, -2, -3, -2, -1, 0, -1, -2, -1, 0, -1, 0, -1, -2, -1, 0, -1, -2, -3, -4, -3, -2, -1, 0, 1, 2, 1, 0, 1, 0, -1, 0, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 1, 0, -1, 0, -1, 0, 1, 0, -1, 0, 1]
[0, -1, -2, -3, -2, -3, -2, -1, -2, -1, 0, 1, 0, 1, 0, -1, -2, -1, 0, -1, -2, -1, -2, -3, -2, -3, -2, -3, -4, -3, -2, -1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 3, 4, 5, 6, 5, 6, 5, 6, 7, 8, 9, 8, 9, 8, 7, 8, 7, 6, 5, 4, 3, 2, 3, 4, 3, 2, 3, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 4, 3, 4, 3, 2, 1, 0, 1, 2, 1, 2, 1, 0, -1, 0, 1, 2, 1, 2, 1, 0, 1]
[0, 1, 2, 1, 0, 1, 0, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, -1, -2, -3, -2, -3, -4, -3, -4, -3, -2, -1, -2, -1, 0, 1, 2, 1, 2, 1, 2, 1, 0, -1, 0, -1, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, 0, -1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 2, 3, 4, 5, 6, 7, 8, 7, 8, 9, 8, 9, 10, 11, 10, 9, 10, 11]
[0, -1, -2, -1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 5, 6, 5, 4, 5, 4, 3, 4, 3, 2, 1, 0, 1, 0, 1, 2, 1, 2, 3, 4, 5, 4, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 1, 2, 1, 0, -1, -2, -1, 0, 1, 2, 1, 0, -1, 0, -1, -2, -1, -2, -3, -2, -3, -4, -3, -4, -5, -4, -3, -4, -5, -4, -3, -2, -3, -2, -1, -2, -1, -2, -3, -4, -5, -6, -7, -6, -5]
[0, -1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 1, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 6, 7, 6, 7, 6, 5, 4, 3, 4, 3, 4, 3, 4, 5, 6, 5, 4, 5, 6, 5, 6, 5, 6, 7, 8, 7, 6, 7, 8, 9, 8, 9, 10, 9, 10, 11, 10, 9, 10, 9, 8, 7, 6, 5, 4, 5, 4, 5, 6, 7, 6, 5, 4, 3, 4, 5, 6, 5, 4, 3]
[0, 1, 0, 1, 2, 1, 0, -1, -2, -3, -4, -3, -2, -3, -4, -3, -4, -5, -4, -5, -4, -3, -4, -3, -2, -3, -2, -1, -2, -1, 0, 1, 2, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 7, 8, 9, 8, 7, 8, 7, 8, 7, 8, 7, 6, 7, 6, 7, 8, 9, 8, 7, 8, 7, 8, 9, 10, 11, 12, 13, 14, 13, 12, 13, 12, 13, 14, 13, 12, 11, 12, 13, 14, 13, 14, 13, 14, 15, 14, 13, 14, 15, 16, 17, 18, 19, 18, 19, 18, 19]
[0, 1, 0, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 3, 4, 5, 4, 3, 4, 3, 4, 3, 4, 5, 4, 5, 4, 5, 4, 3, 4, 3, 2, 3, 4, 5, 6, 5, 6, 7, 6, 5, 6, 7, 6, 5, 4, 5, 4, 3, 4, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, 0, 1, 2, 1, 0, 1, 0, -1, 0, -1, 0, -1, 0, 1, 2, 3, 4, 5, 6, 5, 6, 7, 6, 7, 6, 5, 6, 5]