Showing results for 
Search instead for 
Did you mean: 
New Member

rand() function not doing whats written in its description

Hello everyone,


I'm trying to generate a random number between 0 and 2.

The rand()-functions descriptions says something like:   "... (including both corner numbers)" 

The below screenshot is in german, but I assume the english meaning is clear.

However, after some test, rand(0,2) definitly generates only either 0 or 1, not including the upper border 2.


Can anyone verify this behavior? 



Community Support
Community Support

Hi @JaFeKl,


Thanks for your feedback!

Please refer to the document:

This example gets a random integer from the specified range, excluding the maximum value:

rand(0,2) it will return 0 or 1. If you want to return 0,1 or 2, it should be rand(0,3).

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

New Member

Then you should definitely change the functions description in flow which is misleading, since it says that the upper max value is included.

Helpful resources

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group


Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Users online (71,312)