The `rand`

function can be used in custom filters and table calculations to return a random number between 0 and 1.

# Syntax

`rand()`

The `rand`

function returns a random number between 0 and 1.

# Examples

The `rand`

function is often used to generate random integers, sometimes to select a random sampling of data. For example, to generate an integer between 1 and 100 (inclusive) you could use:

```
(floor(rand()*100)+1)
```

This expression works as follows:

- Uses the
`rand()`

function to generate a random number between 0 and 1. - Multiplies by 100 to turn it into a random number between 1 and 100.
- Uses the
`floor`

function to round down the random number to the nearest integer, producing a random number between 0 and 99 (inclusive). - Adds 1 to bring the random integer up to 1 to 100 (inclusive).

You could then filter your report to only include data below a certain random number.

# Things to know

The `rand`

function produces a number with 16 decimal places, such as 0.04277424614631747.