---
title: "gen_random_uuid function in Strata | Oplema"
description: "Return a random UUID v4 for each row, such as 7e7ea35f-f813-46ce-ac7b-12658c021bcb. Write it as gen_random_uuid() in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/gen-random-uuid"
updated: "2026-11-04"
---

# gen\_random\_uuid

Return a random UUID v4, such as 7e7ea35f-f813-46ce-ac7b-12658c021bcb.

Also available as uuid.

## Try an expression

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

### Expression

```
gen_random_uuid()
```

### Expected behavior

```
A newly generated version 4 UUID.
```

The expression returns `UUID`. Formula stores it as `VARCHAR` in this example. Its value varies between executions; the example checks its behavior rather than a fixed value.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | 2d6a5fd4-ef6d-4e12-b3b9-376a5c2f95ec |

## Arguments and types

```
gen_random_uuid()
```

Supported signatures (1)

```
gen_random_uuid() → UUID
```

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

## Related functions

[uuid

Return a random UUID v4, such as 7e7ea35f-f813-46ce-ac7b-12658c021bcb.

](https://oplema.com/docs/strata/functions/uuid)[uuidv4

Return a random UUID v4, such as 7e7ea35f-f813-46ce-ac7b-12658c021bcb.

](https://oplema.com/docs/strata/functions/uuidv4)[uuidv7

Return a random, time-ordered UUID v7, such as 019482e4-1441-7aad-8127-eec99573b0a0.

](https://oplema.com/docs/strata/functions/uuidv7)[typeof

Return the name of an expression's data type.

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

[Browse conversion & identifiers](https://oplema.com/docs/strata/functions#conversion-&-identifiers) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/utility.html#gen_random_uuid)

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