1. 首页
  2. 数据库
  3. 其它
  4. python之随机漫步模拟

python之随机漫步模拟

上传者: 2020-12-31 04:33:23上传 PDF文件 176.07KB 热度 19次
以下是随机漫步的一种实现方式 from random import choice as choice import matplotlib.pyplot as plt class RandomWalk(): #创建随机漫步的类 def __init__(self,num_points=5000): self.num_points = num_points self.x_values = [0] self.y_values = [0] def fill_walk(self): #计算随机步长并将新的位置加入列表
下载地址
用户评论