---
title: random function
description: Learn the syntax of the random function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/random
---

# `random` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns a random value between 0 and 1. This function is a synonym for [`rand` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/rand.md).

## Syntax

```
random( [ seed ] )
```

## Arguments

* `seed`: An optional `INTEGER` literal.

## Returns

A `DOUBLE`.

The function generates pseudo random results with independent and identically distributed uniformly distributed values in `[0, 1)`.

This function is non-deterministic.

## Examples

```sql
> SELECT random();
 0.9629742951434543

> SELECT random(0);
 0.8446490682263027

> SELECT random(null);
 0.8446490682263027
```

## Related functions

* [`randn` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/randn.md)
* [`rand` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/rand.md)
* [`randstr` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/randstr.md)
* [`uniform` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/uniform.md)
