import numpy as np import matplotlib.pyplot as plt from plotstyle import * def random_walk(n, p, rng): steps = rng.rand(n) steps[steps>=p] = 1 steps[steps