> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oxla.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RANDOM

## Overview

The `RANDOM()` function in Oxla generates a random number within a defined range. By default, the range is between 0 (inclusive) and 1 (exclusive), resulting in a value greater than or equal to 0 and less than 1.

## Syntax

The syntax for generating a random integer or floating-point number using the `RANDOM()` function is as follows:

```sql theme={null}
RANDOM()
```

<Note>There are no parameters or arguments for the `RANDOM()` function.</Note>

## Examples

### Case #1: Generating a random number

The RANDOM() function generates a random number greater than or equal to zero but less than one by default. The following statement can be used to retrieve a random number:

```sql theme={null}
SELECT RANDOM();
```

As a result, you will get a random number greater than 0 and less than 1. However, it will never return the maximum value of 1.

```sql theme={null}
+-----------------------+
| f                     |
+-----------------------+
| 0.9122627193276355    |
+-----------------------+
```

### Case #2: Generating a random decimal number within a range

To generate a random decimal number between two values, you can use the following statement:

```sql theme={null}
SELECT RANDOM()*(b-a)+a;
```

Where:

* **"a"** represents the lower bound of the range.
* **"b"** represents the upper bound of the range.

The return value will be a random floating-point number greater than or equal to a and less than b.&#x20;

**Example**

To generate a random decimal number greater than or equal to 10 and less than 25, the following statement can be used:

```sql theme={null}
SELECT RANDOM()*(25 - 10)+10;
```

Below is an example of a random number that you may retrieve:

```sql theme={null}
+-----------------------+
| f                     |
+-----------------------+
| 18.156098711616043    |
+-----------------------+
```

<Warning>It is important to note that the function will never return the maximum value of b.</Warning>
