Create random numbers
Function: Create random numbers
This action generates a list of random numbers based on your specified range and quantity. It then stores this list in a new variable within your application, which you can name and use in subsequent steps. This is useful for simulations, generating unique IDs, creating test data, or any scenario requiring a set of unpredictable numerical values.
Input
- Maximum value: A
NUMBERthat sets the highest possible value for the random numbers. For example, if you enter100, no generated number will be greater than 100. - Minimum value: A
NUMBERthat sets the lowest possible value for the random numbers. For example, if you enter1, no generated number will be less than 1. - Amount of values: A
NUMBERspecifying how many random numbers you want to generate in the list.
Output
- Variable name: This is the
TEXTyou provide to name the new variable that will hold the list of random numbers. This name is required. The variable created will contain anARRAY(a list) ofNUMBERs.
Execution Flow
Real-Life Examples
Example 1: Generating Lottery Numbers
Imagine you're building a simple lottery number generator. You want to pick 6 random numbers between 1 and 49.
- Inputs:
- Maximum value:
49 - Minimum value:
1 - Amount of values:
6 - Variable name:
LotteryNumbers
- Maximum value:
- Result: A new variable named
LotteryNumbersis created, containing a list of 6 random numbers (e.g.,[12, 5, 33, 48, 21, 1]). You can then display these numbers to the user.
Example 2: Creating Test Scores for a Quiz
You need to simulate quiz scores for 10 students, where scores can range from 0 to 100.
- Inputs:
- Maximum value:
100 - Minimum value:
0 - Amount of values:
10 - Variable name:
QuizScores
- Maximum value:
- Result: A new variable named
QuizScoresis created, containing a list of 10 random numbers (e.g.,[78, 92, 55, 81, 63, 99, 70, 85, 42, 77]). This list can be used for further analysis or display.
Example 3: Assigning Random Product Discount Codes
For a promotional campaign, you want to generate 3 unique discount percentages between 10% and 25% for specific products.
- Inputs:
- Maximum value:
25 - Minimum value:
10 - Amount of values:
3 - Variable name:
ProductDiscounts
- Maximum value:
- Result: A new variable named
ProductDiscountsis created, containing a list of 3 random numbers (e.g.,[15, 22, 18]). These numbers can then be used to apply discounts to products.