rnd:weighted-n-of-with-repeats
rnd:weighted-n-of-with-repeats size agentset [ reporter ]
Reports a list of the given
size
randomly chosen from the agentset
, with repeats. (Why a list instead of an agentset? Because an agentset cannot contain the same agent more than once.)The probability of each agent being picked is proportional to the weight given by the
reporter
for that agent. The weights must be non-negative numbers.It is not an error for
size
to be greater than the size of the agentset
, but there has to be at least one candidate.If, at some point during the selection, there remains only candidates with a weight of 0.0, they all have an equal probability of getting picked.
If all weights are 0.0, each candidate has an equal probability of being picked.