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

# __RandomString

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

**TL;DR:** `__RandomString` generates a random string of a given length, optionally from a specific character set — handy for unique-ish usernames, search terms, or filler payload data.

The RandomString function returns a random String of length using characters in chars to use.

| Name | Required | Description |
| --- | --- | --- |
| Length | Yes | A number length of generated String |
| Characters to use | No | Chars used to generate String |
| Variable Name | No | A reference name for reusing the value                 computed by this function. |

Examples:

```bash
\${__RandomString(5)}
```

will return a random string of 5 characters which can be readable or not

```bash
\${__RandomString(10,abcdefg)}
```

will return a random string of 10 characters picked from `abcdefg` set, like `cdbgdbeebd` or `adbfeggfad`, …

```bash
\${__RandomString(6,a12zeczclk, MYVAR)}
```

will return a random string of 6 characters picked from `a12zeczclk` set and store the result in `MYVAR`, `MYVAR` will contain
string like `2z22ak` or `z11kce`, …

### Example

```plaintext
${__RandomString(5)}                     → random 5-char string
${__RandomString(10,abcdefg)}            → 10 chars from "abcdefg" only
${__RandomString(6,a12zeczclk,myVar)}    → stored in variable "myVar" too
```

Not cryptographically random — don’t use this to generate anything security-sensitive (tokens, secrets). For unique IDs instead of random noise, see [__UUID](/functions/uuid/).

## Related

- [Functions and Variables Guide](/topics/functions-and-variables/)
- [Regex Extractor Builder](/tools/regex-tester/)
- [CSV Data Set & Parameterization](/topics/csv-data-set-config-guide/)
- [Full Functions Reference](/user-manual/functions/)
- [Component Reference](/user-manual/component-reference/)
