# randomInt() Function & Examples

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

## randomInt

#### randomInt(max)

#### randomInt(min, max)

#### randomInt(size)

#### randomInt(size, max)

#### randomInt(size, min, max)

Try it yourself:

```calculio
randomInt(10, 20)
randomInt([2, 3], 10)
```

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

---

## randomInt(): Random Integer Selection

**randomInt()** generates a pseudo-random integer in its requested bounds. It suits dice-like simulations, selecting an index, and discrete test cases.

## Bound conventions

Check whether your intended endpoints are included and test boundary cases. Bounds should be integer values; use [floor()](https://calcul.io/function/floor/index.md) or [ceil()](https://calcul.io/function/ceil/index.md) deliberately if raw limits originate from decimal calculations. Do not use [round()](https://calcul.io/function/round/index.md) on [random()](https://calcul.io/function/random/index.md) as a substitute, because it can bias endpoint probabilities.

For selecting from a collection, ensure the result matches valid indices and confirm length using [size()](https://calcul.io/function/size/index.md). Reproducibility still matters for tests and simulations.

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