python - 在python中生成随机数流
问题描述
我正在尝试在 python 中为模拟模型生成一个唯一随机数流。我想运行模拟 100 次,即 100 次。这是我尝试过的
s=Simulation()
for i in range(100): #performs 100 simulation runs
np.random.seed(i)
while s.clock <= 240: #runs the simulation model for 240 minutes
s.time_adv()
print(s.num_arrival) #print the number of arrivals in in each simulation run
这是我每次得到的输出
85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
我希望每次模拟运行,在 100 次运行中,都有一个唯一的随机数序列
解决方案
推荐阅读
- php - 我如何仅使用 php 和 mysql 数据库在周六网页中查看员工的周日生日
- c++ - 亚马逊示例 transfermanager 代码无法编译
- scala - Spark Scala 对两个数据框中的列进行一些数学运算
- java - 如何使用 Android Studio 删除 JsonArray 中的反斜杠 ("\"")?
- sql - 查询:我只需要检索特定“Pro”列的值仅为 A 的那些行
- multithreading - 如何防止线程在视觉上混淆彼此的输出?
- amazon-web-services - 如果 AWS IoT 中没有 Device Shadows 概念会发生什么
- python - 如何有条件地修改 numpy 多维数组的每个元素?
- excel - 我需要一种方法将未知的最后一个单元格与其他单元格连接起来,并使用带有前导零的格式
- swift - Swift 相当于 PHP 中的 hash_hmac