# rnd() function

The rnd() function generates a random
number.

## Syntax

```
rnd(num.exp)
```

## Parameter(s)

| num.exp | Specifies the maximum number minus one from which the rnd() function creates a random number. The minimum number is always 0. the maximum value allowed is 32,000. |
| --- | --- |

## Example(s)

The rnd() function
in this example generates a random number between 1 and 8. 1 is
added to the result to ensure that the increment is never zero.

```
increment = rnd(8) + 1
```

## See also

- [BASIC functions](https://d3codex.com/pickbasic-flashbasic/basic-functions/)
- [Numeric expressions](https://d3codex.com/pickbasic-flashbasic/numeric-expressions/)
- [precision statement](https://d3codex.com/pickbasic-flashbasic/precision-statement/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)

---
Source: https://d3codex.com/pickbasic-flashbasic/rnd-function/ - part of the D3Codex reference.
