---
title: "random function in Strata | Oplema"
description: "Return a random number between 0 and 1, generated separately for each row. Write it as random() in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/random"
updated: "2026-11-04"
---

# random

Return a random number between 0 and 1. Each row gets a new value.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **DOUBLE**.

### Expression

```
random()
```

### Expected behavior

```
A number greater than or equal to 0 and less than 1.
```

Its value varies between executions; the example checks its behavior rather than a fixed value.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | 0.6439 |

## Arguments and types

```
random()
```

Supported signatures (1)

```
random() → DOUBLE
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

The result can change each time the expression is evaluated.

## Related functions

[bit\_count

Returns the number of bits that are set.

](https://oplema.com/docs/strata/functions/bit-count)[isnan

Check whether a number is NaN, the special "not a number" value.

](https://oplema.com/docs/strata/functions/isnan)[cbrt

Calculate the cube root of a number.

](https://oplema.com/docs/strata/functions/cbrt)[ceil

Round a number up to the nearest whole number.

](https://oplema.com/docs/strata/functions/ceil)

[Browse numbers](https://oplema.com/docs/strata/functions#numbers) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/numeric.html#random)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
