---
title: random
description: |
  Returns a pseudorandom decimal between `0` (inclusive) and `1` (exclusive).

  !!! note
      `random` is not cryptographically secure.
url: https://coralogix.com/docs/dataprime/language-reference/functions-reference/number/random/
product: dataengine
feature: DataPrime Language
feature_id: dataprime-language
feature_identifier: dataengine/dataprime-language
last_updated: '2026-10-21'
---

# `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

}
```
