Generate Random numbers within a range in Power Apps Canvas apps

Welcome to my blog. In today’s blog i am going to discuss on the different options to generate random numbers in Power Apps canvas apps.

Many a times in our development, we need to generate uniqueness – for example auto-generated unique number, unique control names etc. What better way than to use the traditional Rand() function available in Power Apps?

Below is the Rand() function in action

How to generate random numbers within a range in Canvas apps

While it works perfectly fine, there is a problem with this function. The function always generate a random number between 0 and 1. If you have requirement to generate random number between 1 and 1000, it won’t be able to do so.

Microsoft have recently introduced a new function RandBetween() to handle such scenarios. RandBetween() function allow to generate random numbers within a range.

Below is the RandBetween function in action.

And the syntax. Remember than RandBetween will always return a whole number.

RandBetween(1,1000)

Hope this helped! You will also like the below post.

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading