Random Variables

Applies to LoadComplete 4.97, last modified on May 20, 2019

Random variables return a random value from the specified range every time the variable is accessed during the test run. You can use these variables to make your load tests dynamic by parameterizing requests with random values:

GET /cart/add/?pid=@ProductID HTTP/1.1

For example, if you configure the variable in the example above to generate random values from 1 to 100, different virtual users will be able to send this request with different parameters:

GET /cart/add/?pid=15 HTTP/1.1
GET /cart/add/?pid=97 HTTP/1.1
GET /cart/add/?pid=42 HTTP/1.1
and so on

This way, your virtual users will be able to browse or order random items in your tested online shop. As a result, you will get more realistic behavior than that when using the same recorded values for all virtual users.

We recommend that you select a variable whose data type matches the parameter data type. If LoadComplete fails to convert the variable value to the parameter data type, the test server may raise an error.


Random variables have the following parameters:


The variable name, which will be used to refer to this variable in request parameters. The name can include only letters (A..Z, a..z), digits (0..9) or underscores ( _ ) and must be unique within the project.

Prefix and Suffix

Arbitrary strings that are added before and after the random value, respectively.

From and To

The range of possible values (this range includes both From and To). To must be greater than From. The generated value is greater than or equal to From and less than or equal to To.
Note: When generating random dates, specify the From and To values in the short date format that is defined in the Regional and Language Options on the current computer. For example, if your computer uses the English (United States) format, the June 24, 2008 date should be specified as 6/24/2008.

Value Type

The type of the random value to be generated:
  • Integer (default)
  • Float
  • Date

Note that the value type also determines the format of the generated values. When a virtual user requests the variable value during the load test run, the value is returned in the format defined by the Regional and Language Options on the virtual user’s workstation. For example, the June 24, 2008 date will be formatted as 6/24/2008 on workstations with English (United States) format settings, as 24.06.2008 on workstations with German format settings, as 2008-06-24 on workstations with Polish format settings, and so on.

See Also

Incremental Variables
List Variables
Excel Variables
CSV Variables
Database Variables
Constant Variables
Current Date Variables

Highlight search results