Randomize

Randomly select one item from a list

Node Type

Action

Category

Data Translation

Icon

Shuffle

Overview

The Randomize node is a utility node that randomly selects a single value from an input array. This powerful tool enables variety in your workflows, random decision-making, and unpredictable outcomes. Perfect for creating dynamic content, random sampling, or adding randomness to automated processes.

Key Features

  • Random Selection: Uses Math.random() for true randomness
  • Array Processing: Works with any array of string values
  • Complete Output: Returns selected value, index, and original array
  • Error Handling: Gracefully handles empty arrays and invalid inputs
  • Index Tracking: Provides the position of the selected item
  • Data Preservation: Maintains the original array for further processing

Prerequisites

Data Requirements

Understanding of array data structures and random selection needs

Array input with multiple values to choose from
Understanding of random selection use cases
Workflow design that can handle random outcomes

Use Case Planning

Strategic planning for random selection

Random Selection: Identify where variety or unpredictability is needed
Array Processing: Plan how to handle the selected value and index
Workflow Logic: Design workflows that can work with random outcomes

Node Configuration

Required Fields

input

Type:array
Required:Yes
Value Type:array_string

An array of values to randomly select from. Must contain at least one item. The node will pick one random value from this array using Math.random().

Examples & Use Cases

Random Greeting Selection

Add variety to automated messages

{
  "input": [
    "Hello!",
    "Hi there!",
    "Greetings!",
    "Hey!",
    "Welcome!"
  ]
}

Randomly selects one greeting from the array for use in emails, notifications, or chat messages.

A/B Testing Content

Randomly assign test variants

{
  "input": [
    "variant-a-cta",
    "variant-b-cta",
    "variant-c-cta"
  ]
}

Randomly assigns users to different test variants for A/B testing campaigns.

Random Team Assignment

Distribute tasks randomly among team members

{
  "input": [
    "alice@company.com",
    "bob@company.com",
    "charlie@company.com"
  ]
}

Randomly assigns incoming tasks or support tickets to available team members.

Best Practices

Do's

  • Provide arrays with multiple options for true randomness
  • Handle empty array cases in your workflow logic
  • Use randomIndex when you need to track which option was selected
  • Combine with If-Else nodes for conditional random routing
  • Test your workflow with all possible random outcomes
  • Store random selections for audit trails if needed

Don'ts

  • Don't use empty arrays as input
  • Avoid assuming specific outcomes in downstream nodes
  • Don't use for cryptographic randomness
  • Avoid very large arrays if performance is critical
  • Don't forget to handle all possible random values
  • Avoid using single-item arrays (defeats the purpose)
💡
Pro Tip: When testing workflows with random nodes, try running them multiple times to ensure all possible outcomes are handled correctly. Consider logging the randomIndex for debugging and analytics purposes.

Troubleshooting

Common Issues

Empty Array Error

Symptoms: Node fails with empty array or null input

Solution: Ensure your input array contains at least one value. Add conditional logic before the Randomize node to check array length.

Unexpected Values

Symptoms: Selected values don't match expectations

Solution: Verify the input array format is correct (array of strings). Check that template variables are properly resolved before reaching this node.

Not Random Enough

Symptoms: Same values appear frequently

Solution: This is normal with true randomness. Math.random() is pseudorandom but sufficient for most use cases. For cryptographic randomness, use a different approach.

Related Resources