# Rand

## Y ## What is the Power Fx Rand Function?

The Power Fx Rand function is a built-in function in Power Apps that generates a random number between 0 and 1. This function is often used in conjunction with other functions to generate random numbers within a specific range. For example, if you wanted to generate a random number between 1 and 100, you could use the formula:

RoundUp(Rand()*100,0)

``` This formula would generate a random number between 0 and 100, and then round it up to the nearest whole number. The Power Fx Rand function is a quick and easy way to generate random numbers in your Power Apps. How to Use the Power Fx Rand Function Using the Power Fx Rand function in your Power Apps is easy. Simply follow these steps: 1. Open the Power App where you want to generate a random number. 2. Click on the text box or input field where you want to display the random number. 3. Click on the "fx" button next to the formula bar. 4. In the "Insert Function" dialog box, type "Rand" in the search bar. 5. Select the "Rand" function from the list of functions. 6. In the formula bar, type "=Rand()" to generate a random number between 0 and 1. 7. If you want to generate a random number within a specific range, use the formula we discussed earlier. Examples of Using the Power Fx Rand Function Let's look at a few examples of how to use the Power Fx Rand function in Power Apps: Example 1: Generate a Random Number for a Game Suppose you're building a game in Power Apps and you want to generate a random number between 1 and 10 for the player's score. Here's how you could use the Power Fx Rand function: 1. Create a text box or input field to display the player's score. 2. Click on the "fx" button next to the formula bar. 3. Type the following formula in the formula bar: ```

RoundUp(Rand()*10,0)

``` 4. Click "OK" to save the formula. 5. The text box or input field will now display a random number between 1 and 10 each time the app is loaded. Example 2: Generate a Random Password Suppose you're building an app that requires users to create a password. You want to generate a random password for the user to use. Here's how you could use the Power Fx Rand function: 1. Create a text box or input field to display the password. 2. Click on the "fx" button next to the formula bar. 3. Type the following formula in the formula bar: ```

Mid(Concatenate(Rand(),Rand(),Rand(),Rand(),Rand()),1,10)

``` 4. Click "OK" to save the formula. 5. The text box or input field will now display a random 10-character password each time the app is loaded. The Power Fx Rand function is a powerful tool for generating random numbers in Power Apps. Whether you're building a game or an app that requires a random password, the Power Fx Rand function can save you time and effort. By following the steps we've outlined in this article, you can start using the Power Fx Rand function in your Power Apps today. Power Apps Training Courses by G Com Solutions (0800 998 9248) 1-Week Intensive Power Apps Training Course £4,975.00 Select optionsContinue Loading Done Power Apps Introduction (2 Days) £1,990.00 Select optionsContinue Loading Done Power Apps Intermediate (1 Day) £995.00 Select optionsContinue Loading Done Power Apps Advanced (2 Days) £1,990.00 Select optionsContinue Loading Done ```
``` ```
``` ```
``` ```
``` ```
``` ```