Skip to content

Generate Random

Create random values on the fly in your HubSpot workflows. Generate unique identifiers, create test data, assign random numbers for A/B testing, or produce secure tokens—all without leaving the workflow editor.

Use Generate Random when you need unpredictable values in your automation workflows. Perfect for creating unique reference numbers, generating temporary passwords, assigning contacts to random test groups, or producing unique identifiers for tracking.

Choose the type of random value to generate. The UI automatically reveals additional inputs based on your selection.

Available Types:

  • Random Number - Generate random integers within a specified range
  • UUID v4 - Generate universally unique identifiers (version 4)
  • Random String - Generate random strings with configurable length and character sets

Depending on the random type you select, you may see additional fields:

Random TypeExtra fields
numberminValue, maxValue (both optional, defaults: 0-100)
uuidNo additional fields
stringlength (required), characterSet (optional, defaults to alphanumeric)

The generated random value. All values are returned as strings for consistency, even random numbers.

Type: Random Number (min=1, max=1000)
Output (randomValue): 427
Type: UUID v4
Output (randomValue): 550e8400-e29b-41d4-a716-446655440000
Type: Random String (length=8, characterSet=alphanumeric)
Output (randomValue): aB3xK9mP

Generates a random integer within a specified range (inclusive).

Fields:

  • Minimum Value (optional): The smallest number that can be generated. Defaults to 0 if left empty.
  • Maximum Value (optional): The largest number that can be generated. Defaults to 100 if left empty.

Example:

Min: 1
Max: 100
Possible outputs: 1, 42, 73, 100, etc.

Use Cases:

  • A/B test group assignment (1-10)
  • Random order processing priority
  • Lottery or contest selection
  • Random delay intervals

Generates a universally unique identifier using version 4 (random) specification. UUIDs are 36-character strings in the format xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx.

No additional configuration required.

Example Output:

550e8400-e29b-41d4-a716-446655440000
7c9e6679-7425-40de-944b-e07fc1f90ae7
a3bb189e-8bf9-3888-9912-ace4e6543002

Use Cases:

  • Unique order or ticket reference numbers
  • External system correlation IDs
  • Unique tracking codes
  • Database foreign keys

Generates a random string with configurable length and character set. Perfect for creating temporary passwords, unique codes, or test data.

Fields:

  • String Length (required): How many characters to generate. Must be greater than zero.
  • Character Set (optional): The types of characters to include. Defaults to alphanumeric.

Character Set Options:

  • Alphanumeric (default): A-Z, a-z, 0-9 (62 possible characters)
  • Alphabetic: A-Z, a-z (52 possible characters)
  • Numeric: 0-9 (10 possible characters)
  • Alphanumeric + Symbols: A-Z, a-z, 0-9, !@#$%^&*() (72 possible characters)

Example:

Length: 12
Character Set: Alphanumeric
Possible outputs: aB3xK9mPqR2n, Zx4Yt9Km3Pq1, etc.

Use Cases:

  • Temporary password generation
  • Promo code creation
  • Unique coupon codes
  • Verification tokens
  • Random Type: Random Number
  • Minimum Value: 1
  • Maximum Value: 5
  • Output: 3

Save the output to a custom property like test_group_number and use it in workflow branches.

  • Random Type: UUID v4
  • Output: a3bb189e-8bf9-3888-9912-ace4e6543002

Use this as a unique reference number for orders, tickets, or any record that needs a guaranteed unique identifier.

  • Random Type: Random String
  • String Length: 8
  • Character Set: Alphanumeric
  • Output: K9mP3xQz

Combine with a prefix using the Text Transform action: PROMO-K9mP3xQz

  • Random Type: Random String
  • String Length: 16
  • Character Set: Alphanumeric + Symbols
  • Output: aB3!xK9@mP#qR2$n

Security Note: While this generates a random password, remember that HubSpot workflows should not be used for production password management. Use established authentication systems for user passwords.

  • Random Type: Random Number
  • Minimum Value: 1
  • Maximum Value: 10
  • Output: 7

Assign random priority levels to deals or tickets for load balancing across team members.

  • Randomly assign contacts to test groups
  • Create balanced cohorts for campaigns
  • Random sampling for surveys
  • Generate order reference numbers
  • Create unique tracking codes
  • Produce correlation IDs for external systems
  • Unique ticket or case numbers
  • Generate unique promo codes
  • Create one-time use voucher codes
  • Random discount percentages
  • Randomly assign records to team members
  • Distribute leads evenly across queues
  • Random priority assignment
  • Use appropriate ranges: Keep ranges realistic (e.g., 1-100 for percentages, 1-10 for groups).
  • Document your ranges: Note what different number ranges mean in your workflow descriptions.
  • Consider distribution: Random numbers are uniformly distributed, so all values in the range are equally likely.
  • Perfect for uniqueness: UUIDs are statistically unique and ideal for reference numbers.
  • Database friendly: Great for foreign keys or correlation IDs when integrating with external systems.
  • Case sensitive: UUIDs include lowercase letters; normalize casing if needed.
  • Length matters: Longer strings are more unique. For promo codes, 8-12 characters is typical.
  • Choose the right character set:
    • Use numeric for PIN codes
    • Use alphanumeric for general codes
    • Add symbols only when extra security is needed
  • Avoid confusion: Consider using Text Transform to remove ambiguous characters (0/O, 1/l) if codes will be manually entered.
  • Store the original: Save random values to properties immediately so you can reference them later.
  • Handle duplicates gracefully: While random values are usually unique, for strings and numbers there’s always a theoretical chance of collision. UUIDs are the safest choice when uniqueness is critical.
  • Test your workflows: Run test executions to verify the random values meet your requirements.

All random generation uses cryptographically secure random number generation (crypto.getRandomValues() and crypto.randomUUID()), ensuring high-quality randomness suitable for security-sensitive applications like token generation.

TypeOutput ExampleTypical LengthUniqueness
Random Number (0-100)421-3 charsLow
Random Number (1-1000000)3847291-7 charsMedium
UUID v4550e8400-e29b-41d4-a716-44665544000036 charsExtremely High
String (8, alphanumeric)aB3xK9mP8 charsHigh
String (16, alphanumeric+symbols)aB3!xK9@mP#qR2$n16 charsVery High
  • Text Transform — Format or combine random values with prefixes/suffixes
  • Webhook — Send random values to external systems for validation or storage