def walk(x, n=100, box=0.5, delta=0.2):
    np.random.seed()
w = np.cumsum(x + np.random.uniform(-delta, delta, n))
w = np.where(abs(w) > box)[0]
return w[0] if len(w) else n
pwalk = np.vectorize(walk)
pwalk(np.zeros(10))
Случайное блуждание — параллельная обработка