Usage Of Rand Function In Power Automate

Introduction

In Power Automate, in a few of the scenarios we need to generate a random number of examples to prepare a unique name with text and a combination of Unique numbers so as to provide quick test data then the Rand function is used.

Step 1

Login to the required Power Apps environment using URL make.powerapps.com by providing the user name and password and click on Flows on the left-hand side as shown in the below figure.

Usage Of Rand Function In Power Automate

Step 2

After step 1, click on New Flow, select instant cloud flow, provide the trigger as Manually trigger a flow, and click on Create as shown in the figure below.

Usage Of Rand Function In Power Automate

Step 3

After step 2, click on + New Step and under choose an operation and in-text box type compose and select Compose Data Operation as shown in the below figure.

Usage Of Rand Function In Power Automate

Step 4

After step 3, rename compose title with rand Function and click on Inputs and select 2nd tab Expression and type rand and observe it expect 2 parameters first 1 minValue with integer type, 2nd is maxValue of integer type we can pass as shown in the below figure.

Usage Of Rand Function In Power Automate

Step 5

After step 4, Rand have the following syntax,

rand(minValue: integer,maxValue : integer)

so provide the value as an example

rand(1,9999)

and click on OK shown in the below figure.

Usage Of Rand Function In Power Automate

Step 6

After Step 5, Save and Test flow after clicking on Run Flow and Done and click on OK shown in the below figure.

Usage Of Rand Function In Power Automate

Note

  1. Make sure to save and run the flow whenever you try expressions.
  2. MS documentation is found here.
  3. As an example, maxValue 9999 as in Step 5, you can provide any other value of your choice.

Conclusion

In this way, one can easily generate a random number in few minutes and use it for the required scenario.


Similar Articles