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`

.

## Examples

```
# Patches
w1 <- createWorld(minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4)
pSelect <- oneOf(agents = patches(w1))
# Turtles
t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10))
tSelect <- oneOf(agents = t1)
```