Generate a random number with Ruby logic

Recipe ToolsMarketingDeveloper Tool

What it does

When the clock triggers every 5 minutes, this automation runs Ruby code to generate a random number. The result is logged to the job report based on whether the number is less than or greater than 5.

Who it's for

Engineering teams who need to test random number generation and conditional logic in automated workflows.

How teams use this

Test conditional branching with random values

Run this automation to verify that Ruby code executes correctly and that conditional logic routes the random number to the right log message. Use it to validate workflow behavior before deploying to production.

Monitor random number distribution over time

Let this automation run on schedule and collect the logged results to analyze how often numbers fall below or above the threshold. The job report becomes a data source for testing randomness.

Add a third condition for equality

Extend this automation to include a third branch that checks if the random number equals exactly 5, then log a separate message for that case. This requires adding one more conditional step to handle the edge case.

How it works

  1. Trigger every 5 minutes. The automation starts on a schedule, running every 5 minutes to generate a new random number.
  2. Execute Ruby code to generate number. Run Ruby code in Workato Custom Code that produces a random number and stores it for the next steps to evaluate and log.
  3. Log the result to job report. Check if the random number is less than 5 or greater than 5, then log the appropriate message to the job report based on that condition.