字体:大 中 小
护眼
关灯
上一页
目录
下一页
二章 (第7/12页)
br> 无害模拟:人口中的「概念」传播纯本地模拟 importrandom importstatistics defsimute_spreadpop_size=1000,initial_seed=5,i_prob=0.03,resist_prob=0.1,steps=50: 状态:0=未接触,1=接触但未采纳,2=采纳「感染」 popution=[0]*pop_size 随机设置初始采纳者seed foriinrandom.samplerangepop_size,initial_seed: popution[=2 history=[] forstepinraeps: new_popution=popution.copy foriinrangepop_size: ifpopution[==2: 试着影响k随机接触者 tacts=random.samplerangepop_size,k=5 fortacts: ifpopution[c]
上一页
目录
下一页