Skip to content

__RandomFromMultipleVars

JMeter __RandomFromMultipleVars function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values.

Difficulty
intermediate
Guide type
reference
Estimated read time
1 min read
Last verified version
Verified JMeter 5.6

Also documented in context in the full Functions and Variables reference.

The RandomFromMultipleVars function returns a random value based on the variable values provided by Source Variables.

The variables can be simple or multi-valued as they can be generated by the following extractors:

Multi-value vars are the ones that are extracted when you set -1 for Match Numbers. This leads to creation of match number variable called varName_matchNr and for each value to the creation of variable varName_n where n = 1, 2, 3 etc.

NameRequiredDescription
Source VariablesYesVariable names separated by `
Variable NameNoA reference name for reusing the value computed by this function.

Examples:

Terminal window
\${__RandomFromMultipleVars(val)}

will return a random string based on content of variable val taking into account whether they are multi-value or not

Terminal window
\${__RandomFromMultipleVars(val1|val2)}

will return a random string based on content of variables val1 and val2 taking into account whether they are multi-value or not

Terminal window
\${__RandomFromMultipleVars(val1|val2, MYVAR)}

will return a random string based on content of variables val1 and val2 taking into account whether they are multi-value or not and store the result in MYVAR

On this page