Skip to content

Power Apps

How To Use The Power Apps RANDBETWEEN Function

How To Use The Power Apps RANDBETWEEN Function Summary The Power Apps RANDBETWEEN function generates a random whole number within a specific range. For examp...

Matthew Devaney
Published
Reading time
1 min read

Before you start

Is this guide for you?

Best entry point
Power Apps
Time investment
1 min read

Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/the-complete-power-apps-functions-list/how-to-use-the-power-apps-randbetween-function/. Author: Matthew Devaney.

How To Use The Power Apps RANDBETWEEN Function Summary

The Power Apps RANDBETWEEN function generates a random whole number within a specific range. For example, we could ask for a random number between 1 and 10. Syntax #1 RandBetween (Bottom, Top) Arguments Name Required? Description Bottom Yes

A whole number that is the lowest number in the range Top Yes

A whole number that is the highest number in the range Examples

Suppose we want to generate a random number between 1 and 10. We could write the following Power Apps RANDBETWEEN function. RandBetween(1, 10)

The result is a random number between 1 and 10. Each time the function is used it returns a different result. The 1st time I call the RANDBETWEEN function the result could be 3. Then the 2nd time I use RANDBETWEEN the result could be 7. The 3rd time I use the RANDBETWEEN function the result could be 1. 3 7 1

A challenge with the RANDBETWEEN function is the result always changes. If we wanted to keep the number generated by RANDBETWEEN for later we could store the result inside a variable.

Set (varRandomNumber, RandBetween( 1 , 10 )) Code language: JavaScript ( javascript ) Did You Enjoy This Article? 😺

Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up

Share this

Tagged

Power Apps

Have a Microsoft 365 topic idea?

Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →