Lesson 3 of 8
Input randomization
Use Excel formulas to randomize API Toolkit inputs and generate varied calculation requests for repeat testing and simulations.
2 min readTest a SpreadsheetWeb API against a wider range of scenarios by generating input values with Excel formulas. Input randomization removes the need to edit a static value before every calculation and is useful for exploratory testing, simulations, and model validation.
Generate a random input
API Toolkit accepts a supported Excel formula as an input value. For example, the lesson uses RANDBETWEEN to generate an issue age between a lower and upper limit.
- Add the workbook value you want to vary to the request inputs.
- Enter a formula such as
RANDBETWEEN(20,80)instead of a fixed value. - Add the same value to the output list if you want the response to show which random input was used.
- Add the calculated result you want to evaluate, such as the total premium.
- Run the calculation several times.
SpreadsheetWeb evaluates the formula for each request. The returned age and premium change together, allowing you to confirm which randomized value produced each result.
Randomize multiple inputs
Each input can use its own formula, so a request can vary several workbook values independently. You can use simple random-number functions or supported statistical formulas that reflect the distribution required by the test.
This approach can support Monte Carlo-style scenarios in which the same workbook calculation is exercised repeatedly with different input combinations. For larger runs, combine randomized formulas with the Batch Calculation feature covered in the next lesson.
Randomized tests are most useful when you also return the generated input values. Doing so keeps every result traceable to the exact scenario evaluated by the calculation engine.