JMeter __RandomString function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values.
Also documented in context in the full Functions and Variables reference.
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:
\${__RandomString(5)}will return a random string of 5 characters which can be readable or not
\${__RandomString(10,abcdefg)}will return a random string of 10 characters picked from abcdefg set, like cdbgdbeebd or adbfeggfad, โฆ
\${__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
Section titled โExampleโ${__RandomString(5)} โ random 5-char string${__RandomString(10,abcdefg)} โ 10 chars from "abcdefg" only${__RandomString(6,a12zeczclk,myVar)} โ stored in variable "myVar" tooNot cryptographically random โ donโt use this to generate anything security-sensitive (tokens, secrets). For unique IDs instead of random noise, see __UUID.