Ask AI
Skip to main content

Create random number

Function: Create random number

This action generates a random number within a specified range and stores it in a new variable within your application's scope. This is useful for tasks requiring unique identifiers, random selections, or numerical simulations.

Input

  • Maximum value (MAX): The highest possible number to generate. (Type: Number)
  • Minimum value (MIN): The lowest possible number to generate. (Type: Number)

Output

  • Variable name (NAME): The name of the variable to store in the variable scope. (Type: Number)

Execution Flow

Real-Life Examples

Here are some practical ways you can use the "Create random number" action in your applications:

Example 1: Generating a unique order ID

You need to assign a unique, random order ID to each new customer order.

  • Inputs:
    • Maximum value: 99999
    • Minimum value: 10000
    • Variable name: OrderID
  • Result: A new variable named OrderID is created in your application's scope, containing a random number between 10000 and 99999 (e.g., 54321). This OrderID can then be used in your order records.

Example 2: Randomizing a discount percentage for a promotion

For a marketing campaign, you want to offer customers a random discount between 5% and 20%.

  • Inputs:
    • Maximum value: 20
    • Minimum value: 5
    • Variable name: DiscountPercentage
  • Result: A new variable named DiscountPercentage is created, containing a random number between 5 and 20 (e.g., 12). You can then use this variable to calculate the final price for the customer.

Example 3: Assigning a temporary user ID for a survey

When a user starts a survey, you want to assign them a temporary, anonymous ID for tracking purposes.

  • Inputs:
    • Maximum value: 1000
    • Minimum value: 1
    • Variable name: SurveyUserID
  • Result: A new variable named SurveyUserID is created, containing a random number between 1 and 1000 (e.g., 789). This ID can be used to track their progress through the survey without revealing personal information.