### min-n-of

#### min-n-of number agentset [reporter]

Reports an agentset containing number agents from agentset with the lowest values of reporter. The agentset is built by finding all the agents with the lowest value of reporter, if there are not number agents with that value then the agents with the second lowest value are found, and so on. At the end, if there is a tie that would make the resulting agentset too large, the tie is broken randomly.

    ;; assume the world is 11 x 11
    show min-n-of 5 patches [pxcor]
    ;; shows 5 patches with pxcor = min-pxcor
    show min-n-of 5 patches with [pycor = 0] [pxcor]
    ;; shows an agentset containing:
    ;; (patch -5 0) (patch -4 0) (patch -3 0) (patch -2 0) (patch -1 0)

See also min-one-of, with-min.

Take me to the full NetLogo Dictionary