Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Fnumber%2Frandom.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Fnumber%2Frandom.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `random`

## Description

Returns a pseudorandom decimal between `0` (inclusive) and `1` (exclusive).

Note

`random` is not cryptographically secure.

## Syntax

```
random(): number
```

## Example

**Use case: Add a random decimal field**

Generate a pseudorandom number between `0` and `1` and attach it to each document.

### Example data

```
{

    "event": "login_attempt"

}
```

### Example query

```
create random_num from random()
```

### Example output

```
{

    "event": "login_attempt",

    "random_num": 0.732145691

}
```
