Generate a random number from an array
Recipe ToolsData ParserDeveloper Tool
What it does
When a scheduled time arrives, this automation runs ruby code to pick a random number from an array. The output is recorded in the job report for reference.
Who it's for
Engineering teams who need a reusable function to generate random numbers for testing or data operations.
How teams use this
Test systems with random data
Call this automation from another workflow to inject random numbers into test scenarios. The reusable function keeps test data varied without manual input.
Randomize work across team members
Use the random output to distribute tasks or route requests. Add a condition to map the number to a specific person or queue.
Generate sample IDs for records
Call this function when creating test records in a database or CRM. Set the random number as part of a unique identifier for each test run.
How it works
- Start on a schedule. Start this automation on a schedule you set, like every hour or every day.
- Parse the array data. Json Parser extracts the array data from the incoming document so the ruby code can access the values.
- Execute ruby code to get random. Run ruby code that selects a random number from the parsed array and prepares it for output.
- Log the result. Write the random number to the job report so you can see what was generated each time this ran.