# Power Automate Rand Function Explained

The Power Automate Rand function generates a random integer number for a given number range.

In this article, Iâ€™ll introduce you to the rand function and will provide a step-by-step guide on how to use the function in a Microsoft flow.

## Power Automate Rand Function

Generate a random number within a given range, where the lower bound is included but the upper bound is excluded.

### Syntax

``rand(<minValue>, <maxValue>)``

#### Input parameters

• minValue (mandatory): The integer with the lowest value in the range.
• maxValue (mandatory): The integer immediately succeeding the one with the highest value within the range that the function can produce.

#### Return value

• Returns a random integer generated from the given range.

### Power Automate Rand Expression Example

How do you generate a random number in power automate? Here is an example how to generate a random number between 1 and 10.

``````rand(1,11)
// can be any number from 1 to 10 => 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10``````

## How To Use The Power Automate Rand Function

Follow the steps to use the Power Automate Rand function in a flow.

New flow

2. #### Add a new step by clicking on â€˜+ New stepâ€™

Add a new step

3. #### Search for â€˜initializeâ€™ and click on â€˜Initialize variableâ€™

Add Initialize variable action

4. #### Setup Initialize variable: 1) Provide a name, 2) select type Integer, 3) click on in value text field (popup appears), Â 4) click on â€˜Expressionsâ€™, 5) set expression to â€˜rand(1,11) click on â€˜OKâ€™

Setup rand expression in Power Automate

5. #### Save and do a test run

Result test run â€“ Power Automate Rand function example