Random Netlogo:如何创建一个海龟网络,以随机的方式共享相同的功能?

Random Netlogo:如何创建一个海龟网络,以随机的方式共享相同的功能?,random,netlogo,social-networking,Random,Netlogo,Social Networking,我知道如何创建共享相同功能(sds)的海龟网络 我的问题是,有没有可能仅仅将其中的一些联系起来?例如,在给定从零到一的随机概率的情况下,创建一个链接,该概率介于到具有相同sds的海龟之间您需要原语n-of。尝试类似的方法(您可以用更少的行编写代码,但为了可读性,我已经将其扩展了: let target-prop 0.2 ask turtles [ let samesds other turtles with [sds = [sds] of myself] let join-count cei

我知道如何创建共享相同功能(sds)的海龟网络


我的问题是,有没有可能仅仅将其中的一些联系起来?例如,在给定从零到一的随机概率的情况下,创建一个链接,该概率介于到具有相同sds的海龟之间

您需要原语
n-of
。尝试类似的方法(您可以用更少的行编写代码,但为了可读性,我已经将其扩展了:

let target-prop 0.2
ask turtles
[ let samesds other turtles with [sds = [sds] of myself]
  let join-count ceiling target-prop * count samesds
  if any? samesds
  [ create-links-with n-of join-count samesds
  ]
]
现在,您已经对NetLogo进行了一些探索,您可能希望再次阅读教程,并查看库模型,以了解一些可用的原语

let target-prop 0.2
ask turtles
[ let samesds other turtles with [sds = [sds] of myself]
  let join-count ceiling target-prop * count samesds
  if any? samesds
  [ create-links-with n-of join-count samesds
  ]
]