> For the complete documentation index, see [llms.txt](https://docs.inforiver.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inforiver.com/formula-syntax/math-functions/randbetween.md).

# RANDBETWEEN

Generates a random number between two specified values to support simulations and randomized calculations.

The RANDBETWEEN function returns a random number between two specified values. It generates a number within the defined range each time the function is evaluated and is commonly used in simulations, sampling, or testing scenarios where random data is required.

### Syntax

```javascript
RANDBETWEEN(value1,value2)
```

### Arguments

value1 - The smallest integer RANDBETWEEN will return (Required).

value2 - The largest integer RANDBETWEEN will return (Required).

### Example

```javascript
RANDBETWEEN(55,105)
```

In the example below, the *RandBetween* measure is created using the **RANDBETWEEN** function, which generates a random number between 55 and 105.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2Faf4BWC4yz1CgjQ2KdeS1%2Fimage.png?alt=media&amp;token=bf25ff79-a640-4319-bb48-c822ad3b25a9" alt=""><figcaption></figcaption></figure>

### Excel equivalent

[RANDBETWEEN](https://support.microsoft.com/en-us/office/randbetween-function-4cc7f0d1-87dc-4eb7-987f-a469ab381685)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.inforiver.com/formula-syntax/math-functions/randbetween.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
