---
title: "__RandomFromMultipleVars"
description: "JMeter __RandomFromMultipleVars function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values."
url: https://docs.jmeter.ai/functions/randomfrommultiplevars/
lastUpdated: 2026-10-01
source: docs.jmeter.ai
---

# __RandomFromMultipleVars

*Also documented in context in the [full Functions and Variables reference](/user-manual/functions/#__RandomFromMultipleVars).*

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:

- [Boundary Extractor](/components/boundary-extractor/)
- [Regular Expression Extractor](/components/regular-expression-extractor/)
- [CSS Selector Extractor](/components/css-selector-extractor/)
- [JSON Extractor](/components/json-extractor/)
- [XPath Extractor](/components/xpath-extractor/)
- [XPath2 Extractor](/components/xpath2-extractor/)

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.

| Name | Required | Description |
| --- | --- | --- |
| Source Variables | Yes | Variable names separated by ` |
| Variable Name | No | A reference name for reusing the value                 computed by this function. |

Examples:

```bash
\${__RandomFromMultipleVars(val)}
```

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

```bash
\${__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

```bash
\${__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`

## Related

- [Functions and Variables Guide](/topics/functions-and-variables/)
- [Regex Extractor Builder](/tools/regex-tester/)
- [Full Functions Reference](/user-manual/functions/)
- [Component Reference](/user-manual/component-reference/)
