Random Task¶
Overview¶
The Random Task randomly selects one value from a comma-separated list. Each execution picks a different item, making it perfect for A/B testing, load balancing, random assignments, and dynamic content delivery.
When to use this task:
- A/B test variants (emails, landing pages, offers)
- Randomly distribute leads or workload
- Show different promotional content
- Random assignment for fairness
- Load balance across multiple resources
- Gamification and rewards
- Testing scenarios
Key Features:
- Pure random selection
- Uniform probability distribution
- Unlimited list items
- Variable support in list values
- Single-step execution
- Works with any data type
Quick Start¶
Configuration¶
List of Values¶
Values: Option A, Option B, Option C
Values: user1@company.com, user2@company.com, user3@company.com
Values: https://example.com/page-a, https://example.com/page-b
Values: Red, Blue, Green, Yellow, Purple
Format: - Comma-separated values - Any data type (text, numbers, emails, URLs, IDs) - Supports variables: {{task_15001_email}}, backup@company.com - Whitespace around commas is preserved
Example Configurations¶
Two options (50/50):
Three options (33.3% each):
Weighted simulation (repeat values):
Dynamic values:
Output Fields¶
| Field | Description | Example |
|---|---|---|
task_12001_run | Always true if list provided | true |
task_12001_run_text | Message showing selected value | Randomly selected: Option B |
task_12001_response | The randomly selected value | Option B |
Real-World Examples¶
Example 1: A/B Testing Email Campaigns¶
Scenario: Test two email subject lines to optimize open rates
Workflow: 1. Schedule Trigger - Weekly newsletter 2. MySQL Query - Get subscriber list 3. Loop - For each subscriber 4. Random Task - Select subject line variant 5. Email - Send with selected subject 6. Tag contact with variant for tracking
Random Selection:
Send Email:
To: {{task_29001_row.email}}
Subject: {{task_12001_response}}
Hi {{task_29001_row.first_name}},
This week's insights are ready for you...
[Email content same for both variants]
---
Variant: {{task_12001_response}}
Subscriber ID: {{task_29001_row.subscriber_id}}
Track Variant:
MySQL Query: UPDATE subscribers
SET email_variant = '{{task_12001_response}}',
variant_sent_date = NOW()
WHERE subscriber_id = {{task_29001_row.subscriber_id}}
Analysis later: - Track open rates by variant - Identify winning subject line - Use winner for future campaigns
Example 2: Fair Lead Distribution¶
Scenario: Distribute incoming leads randomly across sales team for unbiased allocation
Workflow: 1. Form Submission - Lead inquiry form 2. Phone Formatter - Format phone number 3. Random Task - Assign random sales rep 4. New Client - Create lead with assigned rep 5. Workflow Note - Create follow-up task 6. Email - Notify assigned rep
Random Rep Selection:
Values: sarah.johnson@company.com, michael.chen@company.com, jessica.rodriguez@company.com, david.kim@company.com
Create Lead:
Company Name: {{task_55001_company}} - {{task_55001_full_name}}
Status: New Lead
Responsible Manager: {{task_12001_response}}
Contact:
First Name: {{task_55001_first_name}}
Surname: {{task_55001_last_name}}
Email: {{task_55001_email}}
Cell: {{task_7001_formatted}}
Create Task:
Type: Call
Client ID: {{task_13001_client_id}}
Due: today
Priority: High
User Tags: {{task_12001_response}}
Note: New Inbound Lead - Contact ASAP
Lead: {{task_55001_full_name}} at {{task_55001_company}}
Phone: {{task_7001_formatted}}
Email: {{task_55001_email}}
Budget: ${{task_55001_budget}}
Timeline: {{task_55001_timeline}}
Message:
{{task_55001_message}}
Source: {{task_55001_utm_source}}
Notify Rep:
To: {{task_12001_response}}
Subject: 🔥 New Lead Assigned: {{task_55001_company}}
Hi,
You've been assigned a new lead:
Company: {{task_55001_company}}
Contact: {{task_55001_full_name}}
Phone: {{task_7001_formatted}}
Email: {{task_55001_email}}
[View in CRM]
Example 3: Dynamic Landing Page Selection¶
Scenario: Test multiple landing page designs by randomly directing traffic
Workflow: 1. Webhook In - Ad click event 2. Match to Client - Find existing lead 3. Random Task - Select landing page variant 4. Edit Client - Store variant on client record 5. Webhook Out - Redirect to selected page
Random Page Selection:
Values: https://example.com/landing-minimal, https://example.com/landing-video, https://example.com/landing-testimonials
Store Variant:
Client ID: {{task_15001_client_id}}
Custom Field - landing_page_variant: {{task_12001_response}}
Custom Field - variant_assigned_date: {{current_timestamp}}
Redirect Response:
URL: {{task_12001_response}}
Query Parameters:
- utm_campaign: {{task_46001_campaign}}
- utm_source: {{task_46001_source}}
- lead_id: {{task_15001_client_id}}
302 Redirect to selected landing page
Analytics Tracking:
MySQL Query: INSERT INTO ab_test_log
(client_id, test_name, variant, timestamp, source)
VALUES ({{task_15001_client_id}},
'Landing Page Test Q1',
'{{task_12001_response}}',
NOW(),
'{{task_46001_source}}')
Example 4: Load Balanced API Routing¶
Scenario: Distribute API requests randomly across multiple worker queues
Workflow: 1. Webhook In - API request received 2. Random Task - Select worker queue 3. Variable - Store queue selection 4. Webhook Out - Forward to selected queue 5. MySQL Query - Log routing decision
Random Queue Selection:
Store Queue:
Forward Request:
URL: https://api.company.com/workers/{{task_12001_response}}/process
Method: POST
Headers:
Authorization: Bearer {{api_token}}
X-Request-ID: {{task_46001_request_id}}
X-Routed-From: load-balancer
Body:
{
"request_id": "{{task_46001_request_id}}",
"queue": "{{task_12001_response}}",
"payload": {{task_46001_body}},
"routed_at": "{{current_timestamp}}"
}
Log Routing:
INSERT INTO load_balancer_log
(request_id, selected_queue, timestamp, payload_size)
VALUES ('{{task_46001_request_id}}',
'{{task_12001_response}}',
NOW(),
{{task_46001_content_length}})
Example 5: Gamification - Random Rewards¶
Scenario: Award random prizes to customers completing actions
Workflow: 1. CRM Trigger - Customer completed purchase 2. If Task - Check if eligible for reward 3. Random Task - Select reward tier 4. Code Task - Generate reward code 5. Email - Send reward notification 6. MySQL Query - Record reward issued
Random Reward Selection:
Values: 10% Discount, 15% Discount, 20% Discount, Free Shipping, $25 Credit, $50 Credit, Premium Feature Access
Check Eligibility:
Condition: {{task_47001_total_purchases}} >= 5
And: {{task_47001_last_reward_date}} < (TODAY - 90 days)
Then: Award random reward
Generate Reward Code:
const rewardType = input.task_12001_response;
const clientId = input.task_47001_client_id;
const timestamp = Date.now();
// Generate unique reward code
const code = `REWARD-${clientId}-${timestamp}`.substring(0, 16).toUpperCase();
// Set expiration (30 days)
const expiresAt = new Date();
expiresAt.setDate(expiresAt.getDate() + 30);
return {
reward_code: code,
reward_type: rewardType,
expires_at: expiresAt.toISOString().split('T')[0]
};
Send Reward Email:
To: {{task_47001_email}}
Subject: 🎉 Congratulations! You've Won a Reward!
Hi {{task_47001_first_name}},
Thank you for being a loyal customer!
You've earned: {{task_12001_response}}
Your Reward Code: {{task_42001_reward_code}}
Valid Until: {{task_42001_expires_at}}
[Redeem Now]
Happy shopping!
Record Reward:
INSERT INTO customer_rewards
(client_id, reward_type, reward_code, issued_date, expires_date, status)
VALUES ({{task_47001_client_id}},
'{{task_12001_response}}',
'{{task_42001_reward_code}}',
NOW(),
'{{task_42001_expires_at}}',
'issued')
Best Practices¶
List Design¶
- Equal probability - Each item has 1/N chance
- Simulate weighting - Repeat values to increase probability
- Use descriptive values - Clear, meaningful options
- Keep lists manageable - 2-10 items typical, more for specific use cases
- Validate all options - Ensure every value is valid/usable
Use Cases¶
Good for: - A/B testing (2-4 variants) - Fair distribution (team members, queues) - Dynamic content (images, messages, offers) - Load balancing (servers, workers) - Gamification (rewards, challenges)
Not ideal for: - Ordered cycling (use Round Robin Type 30) - Weighted selection (simulate by repeating values) - Deterministic selection (use If or Key Match) - State-dependent selection (use Code task)
Testing¶
- Test all values - Ensure each option works correctly
- Run multiple times - Verify randomness distribution
- Log selections - Track which values are chosen for analysis
- Monitor outcomes - Measure performance of each variant
- Iterate - Adjust list based on results
Variable Usage¶
# Dynamic lists from previous tasks
Values: {{task_43001_row.rep_email}}, {{task_43001_row.backup_email}}
# Mix static and dynamic
Values: {{task_15001_primary}}, default@company.com
# Use in conditionals
If {{task_12001_response}} = "Option A" then...
Troubleshooting¶
Same Value Selected Multiple Times¶
Issue: Getting the same result repeatedly
Cause: Normal random behavior - not guaranteed to cycle
Solution: - This is expected with random selection - Use Round Robin for guaranteed cycling - Each execution is independent
Empty or Invalid Result¶
Issue: No value returned
Causes: - Empty list provided - Single comma with no values - List not properly formatted
Solution:
# ❌ Wrong
Values:
# ❌ Wrong
Values: ,
# ✓ Correct
Values: Option A, Option B
# ✓ Correct (single value)
Values: Only Option
Unwanted Whitespace¶
Issue: Values have extra spaces
Cause: Spaces around commas are preserved
Solution:
# May have trailing space
Values: Option A , Option B
# Clean (no spaces)
Values: Option A,Option B
# Or use Find Replace task to clean
Probability Not Equal¶
Issue: Some values seem more common
Cause: - Small sample size (random clusters) - Confirmation bias
Solution: - Run many iterations (100+) to see true distribution - Log results to database for analysis - All values have mathematically equal probability
Variable Not Replaced¶
Issue: {{variable}} appears in output
Cause: Variable doesn't exist or is empty
Solution: - Verify previous task ran successfully - Check variable name spelling - Use Coalesce task for fallbacks
Frequently Asked Questions¶
How random is it?¶
Uses JavaScript's Math.random() - suitable for A/B testing and distribution, but not cryptographically secure.
Can I weight the probabilities?¶
Not directly. Simulate by repeating values:
Does it remember previous selections?¶
No, each execution is independent. Use Round Robin for cycling through options.
Can I use with arrays or objects?¶
No, only comma-separated strings. Use Code task to handle complex data structures.
What's the maximum list size?¶
No hard limit, but keep practical (2-100 items). Very large lists may impact readability.
Can I exclude recently selected values?¶
No built-in memory. Would need custom solution using MySQL Query to track and Code task to filter.
Will each option be used equally over time?¶
Over many iterations, yes (law of large numbers). But in small samples, clustering is normal.
Related Tasks¶
- Round Robin - Sequential cycling instead of random
- If Task - Conditional logic based on random result
- Key Match - Map random result to specific values
- Loop - Apply random selection to multiple items
- Variable - Store random result for reuse
- MySQL Query - Log random selections for analysis