Report one `patch`

or `turtle`

randomly selected among `agents`

.

oneOf(agents)
# S4 method for matrix
oneOf(agents)

## Arguments

agents |
Matrix (`ncol` = 2) with the first column `pxcor` and the second
column `pycor` representing the `patches` coordinates, or
Matrix (`ncol` = 3) with the first column "`pxcor` and the second
column `pycor` representing the `patches` coordinates and the
third column `id` , or
`AgentMatrix` object representing the moving `agents` , or
Matrix (`ncol` = 2) with the first column `whoTurtles` and the
second column `id` . |

## Value

Matrix (`ncol`

= 2, `nrow`

= 1) with the first column `pxcor`

and the second column `pycor`

representing the coordinates of the
selected `patch`

from `agents`

, or

Matrix (`ncol`

= 2) with the first column `pxcor`

and the second column `pycor`

representing the coordinates of the
selected `patches`

from `agents`

, one per individual `id`

, or

`AgentMatrix`

object representing the `turtle`

selected from `agents`

, or

Integer. Vector of `who`

numbers for the selected `turtles`

from
`agents`

, one per individual `id`

.

## Details

If `agents`

is a matrix with `ncol`

= 3, the selection of one
random `patch`

is done per individual `id`

. The order of the `patches`

coordinates returned follow the order of `id`

.
If `agents`

is a matrix (`ncol`

= 2) with columns `whoTurtles`

and
`id`

, the selection of one random `turtle`

(defined by their `whoTurtles`

)
is done per individual `id`

. The order of the `who`

numbers returned
follow the order of `id`

.

## References

Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/.
Center for Connected Learning and Computer-Based Modeling,
Northwestern University. Evanston, IL.

## See also

## Examples