import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
ber=[-1,1] # either -1 or 1
n=1
for t in range(10,100,10):
Increments=np.random.choice(ber,size=(n,t))*(1/t)
Price_S=Increments.cumsum(axis=1)
Price_S_0=np.concatenate( [np.zeros([n,1]),Price_S] , axis=1) # add a 0 columnm, make the figure starting from 0
temp=pd.DataFrame(Price_S_0.T)
temp.index=temp.index.values/t
plt.plot(temp)
plot.show()
by Fanyu Zhao