import random
import matplotlib.pyplot as plt\
position = 0
walk=[position]
steps=1000
for i in range(steps):
step=1 if random.randint(0, 1) else -1
position += step
walk.append(position)
#plt.plot(walk[:100])
import numpy as np
nsteps =1000
draws = np.random.randint(0,2,size=nsteps)
steps=np.where(draws>0,1,-1)
walk = steps.cumsum()
'COMPUTER > 파이썬' 카테고리의 다른 글
Spyder에서 ModuleNotFoundError 뜰 때 (0) | 2023.04.05 |
---|---|
부트스트랩(Bootstrap) (0) | 2014.03.15 |