code Link to heading

import random as rnd

steps = 100
Nx = [0] * (steps + 1)
x = []
for i in range(-steps//2, steps//2 + 1):
  x.append(i)

repetition = 10000
for r in range(repetition):
  y = 0
  
  for s in range(steps):
    dy = rnd.randint(0, 1) * 2 - 1
    y += dy

  i = x.index(y)
  Nx[i] += 1

print(x)
print(Nx)

url https://onecompiler.com/python/3zn7mdvfv

result Link to heading

[-50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 2, 0, 5, 0, 9, 0, 13, 0, 25, 0, 51, 0, 68, 0, 99, 0, 157, 0, 225, 0, 307, 0, 353, 0, 499, 0, 572, 0, 674, 0, 740, 0, 780, 0, 848, 0, 760, 0, 747, 0, 670, 0, 567, 0, 478, 0, 364, 0, 298, 0, 231, 0, 151, 0, 106, 0, 78, 0, 39, 0, 45, 0, 19, 0, 7, 0, 5, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

chart Link to heading