9 lines
161 B
Python
9 lines
161 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import numpy as np
|
|
|
|
nsteps = 1000
|
|
draws = np.random.randint(0, 2, size=nsteps)
|
|
steps = np.where(draws > 0, 1, -1)
|
|
walk = steps.cumsum()
|