Is there a way in NetLogo to associate a probability value for each item in an array and randomly select n items? a function like below.
let names ["pooh", "rabbit", "piglet", "Christopher"]
let probs [0.5, 0.1, 0.1, 0.3]
n-random-select 5 names probs
>>["pooh", "pooh", "pooh", "Christopher", "piglet"]
In Python numpy.random.choice
exactly does this.
Aucun commentaire:
Enregistrer un commentaire