模拟色子 import pylab import random duration= 100 mean_inc= 0.2 std_dev_inc= 1.2 x=range(duration) y=[] pricetoday = 0 for i in x: next_data = random.normalvariate(mean_inc, std_dev_inc) pricetoday += next_data y.append(pricetoday) pylab.plot(x, y) pylab.xlabel("time") pylab.ylabel("value") pylab.show() #通过正态分布 模拟虚拟价格增长数据
时间: 2024-12-10 00:29:39