---
title: Math variables
slug: math-variables
description: Generate random numbers to use in your formulas and functions
image: https://archbee-image-uploads.s3.amazonaws.com/oAyFj2GHlBeBVWF5OAir2/j1hVOTVcTfZ5EFVOGOH0v_domino-zoomin-purple-a-1.png
docTags: 
createdAt: 2025-02-03T13:29:15.598Z
---

Use math variables to insert a random number into your functions.

## random

Returns a floating-point, pseudo-random number in the range \[`0`, `1`) (inclusive of `0`, but not `1`).

Use the following formula to generate an integer pseudo-random number in the range \[`min`, `max`] (inclusive of both, `min` and `max`):

::Image[]{src="https://api.archbee.com/api/optimize/oAyFj2GHlBeBVWF5OAir2/gc7yTBq4zGHJH3DFAMrCq_uuid-81fd5f8a-8050-beef-9184-deff3b944d95.png" size="70" width="506" height="88" position="flex-start" alt="Math variable - random" showCaption="false"}

```text
{{floor(random * (1.max - 1.min + 1)) + 1.min}}
```

### Example: Roll the dice

You can employ the `random` variable to create a dice game that randomly picks a number, for example between 1 and 6, and then returns that number to a user.

::::WorkflowBlock
:::WorkflowBlockItem
In the mapping panel of the **Tools > Set variable** module, select the **Math functions** tab.

::Image[]{src="https://api.archbee.com/api/optimize/yAufeXqD1oGWOPBNi5MAm-xyuY8nuBAllnvjQycz-mh-20250226-093022.png" size="60" width="721" height="417" position="flex-start" alt="Random math variable" showCaption="false"}
:::

:::WorkflowBlockItem
Select the `floor` function.
:::

:::WorkflowBlockItem
Insert the following:

```none
{{floor(random * 6) + 1}}
```
:::
::::

