n-of

n-of size agentset
n-of size list

From an agentset, reports an agentset of size size randomly chosen from the input set, with no repeats.

From a list, reports a list of size size randomly chosen from the input set, with no repeats. The items in the result appear in the same order that they appeared in the input list. (If you want them in random order, use shuffle on the result.)

It is an error for size to be greater than the size of the input.

ask n-of 50 patches [ set pcolor green ]
;; 50 randomly chosen patches turn green

See also one-of.

Take me to the full NetLogo Dictionary