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

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Users online (12,813)