Ask AI
Skip to main content

Create random numbers

Function: Create Random Numbers

This function helps you generate a list of random numbers within a specified range and store them in a variable for use in your application. This is useful when you need to simulate data, create unique identifiers, or introduce variability into your processes.

Input

  • Minimum value (NUMBER, optional, default: 0): The smallest possible number that can be generated in your list.
  • Maximum value (NUMBER, optional, default: 10): The largest possible number that can be generated in your list.
  • Amount of values (NUMBER, optional, default: 10): How many random numbers you want to create and include in the list.
  • Variable name (STRING, required, default: "RANDOM_NUMBERS"): The name you want to give to the variable where the list of random numbers will be stored. You will use this name to access the list later in your application.

Output

  • List of Random Numbers (ARRAY of NUMBER): A list containing the generated random numbers. This list will be stored in your application's variable scope under the Variable name you provided.

Execution Flow

Real-Life Examples

Example 1: Simulating Dice Rolls

Imagine you're building a simple game and need to simulate rolling a six-sided die multiple times.

  • Inputs:
    • Minimum value: 1
    • Maximum value: 6
    • Amount of values: 5
    • Variable name: DiceRolls
  • Result: A variable named DiceRolls is created, containing a list of 5 random numbers, each between 1 and 6 (e.g., [3, 6, 1, 4, 2]). You can then use this list to display the results of five dice rolls in your game.

Example 2: Generating a Unique Identifier

You need to create a unique, random 8-digit number for a new customer account.

  • Inputs:
    • Minimum value: 10000000
    • Maximum value: 99999999
    • Amount of values: 1
    • Variable name: NewCustomerID
  • Result: A variable named NewCustomerID is created, containing a single random 8-digit number (e.g., [54321987]). This number can then be assigned as the unique identifier for the new customer.

Example 3: Creating Sample Data for a Survey

You want to generate a list of 15 random ages between 18 and 65 to use as sample data for testing a survey analysis feature.

  • Inputs:
    • Minimum value: 18
    • Maximum value: 65
    • Amount of values: 15
    • Variable name: SampleAges
  • Result: A variable named SampleAges is created, containing a list of 15 random numbers, each between 18 and 65 (e.g., [25, 42, 60, 19, 38, ..., 51]). This list can be used to test how your application processes age-related data.