# pickRandom() Function & Examples

Use the pickRandom() probability function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## pickRandom

#### pickRandom(array)

#### pickRandom(array, number)

#### pickRandom(array, weights)

#### pickRandom(array, number, weights)

#### pickRandom(array, weights, number)

Try it yourself:

```calculio
pickRandom(0:10)
pickRandom([1, 3, 1, 6])
pickRandom([1, 3, 1, 6], 2)
pickRandom([1, 3, 1, 6], [2, 3, 2, 1])
pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])
pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)
```

[random](https://calcul.io/function/random/index.md)

---

## pickRandom(): choose a random item

**pickRandom(collection)** selects an item at random from a collection. It is handy for sampling, simulations, randomized examples, and simple games.

## Sampling considerations

One call returns one selection; repeated calls may choose the same item again. For sampling without replacement, remove selected items or use a dedicated sampling workflow.

## Related random tools

Use [random()](https://calcul.io/function/random/index.md) for numeric random values, [randomInt()](https://calcul.io/function/randomInt/index.md) for integer ranges, and [sort()](https://calcul.io/function/sort/index.md) to randomize an entire list. [size()](https://calcul.io/function/size/index.md) checks the candidate count.

## Caveat

An empty collection cannot supply an item. Do not use ordinary random selection where cryptographic unpredictability is required.

[All functions](https://calcul.io/functions/index.md)
