---
title: "RAND"
description: "The RAND SQL function generates a random number between 0 and 1."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/rand
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/rand
updated: 2026-08-09T00:00:00Z
license: https://documentation.invantive.eu/en/
---

## Syntax
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> RAND[RAND]
    RAND --> End((END))
```

## Purpose
The `RAND` SQL function generates a random number between 0 and 1. It is an alias of [[RANDOM]].

Parameters:
- Seed (optional, `int32`): Produce a repeatable sequence of random numbers each time that seed value is provided.

Returns: A random number between 0 and 1.

## Examples
The following example generates a random number between 0 and 1; the actual value differs per invocation:
```sql
select rand()

-------------------
0.842647311
```
The following example generates a random number between 0 and 1 using a seed:
```sql
select rand(3)

-------------------
0.293519212
```