In Tricentis Tosca, the RND function creates an integer random value from a single length parameter. Set the number of digits inside the brackets—for example, RND[4] generates a four-digit value. It’s a simple way to add varied numeric data to automation flows.

Multiple Choice

What is the syntax for Integer Random Values, Syntax 1?

In Tosca, generating integer random values with Syntax 1 uses the RND function and a single parameter that specifies how many digits the resulting integer should have. This means you write the exact form RND[Length of random number], where the length determines the number of digits in the integer (for example, RND[4] yields a random 4-digit integer). The other options either describe the decimal random values (which use RNDDECIMAL and can include decimal places or ranges) or try to apply a bounds-based form to integers, which isn’t how Syntax 1 for integers works. So the correct form is the one with a single parameter inside RND, indicating the length of the random number.

Generating Random Integer Values in Tricentis Tosca

Random data can make an automated test more useful. A fixed customer number or quantity may work once, but it can also hide problems that appear only with different inputs. Tricentis Tosca provides functions for creating random values, including integers of a chosen length.

For integer random values, Syntax 1 uses this form:


{RND[Length of random number]}

The single parameter sets the number of digits in the generated integer. For example:


{RND[4]}

asks Tosca to generate a random four-digit integer. The key detail is that the parameter describes the number’s length—not a lower or upper limit.

One function, one length parameter

The RND function is for integer values. The number inside the square brackets tells Tosca how many digits to generate. So {RND[2]} requests a two-digit integer, while {RND[6]} requests a six-digit one.

Think of the length as a space on a form: a two-character field and a six-character field serve different needs, even if both hold numbers. This can be useful when an application expects an input with a particular size, such as a short reference number or a longer identifier.

There’s a small but important distinction here. A length is not the same as a range. If a field must accept numbers only between 200 and 500, specifying a length of three digits does not, by itself, express that business rule. It describes the size of the generated value. Any extra range requirement needs to be handled through the relevant data-generation design and validated against the application’s rules.

How to read the syntax

The notation has three parts:

  • { and } mark the Tosca expression.

  • RND names the integer random-value function.

  • [Length of random number] represents the number of digits to generate.

The words in brackets explain the parameter; they are not typed literally. In a test data value, a concrete expression might look like {RND[4]} rather than {RND[Length of random number]}.

That distinction matters when reading Tosca documentation or examples. A phrase such as “Length of random number” is a description of what goes in the brackets. The value supplied there is a digit count, such as 4.

Integer values and decimal values aren’t the same

Tosca also has a separate function for generating decimal random values: RNDDECIMAL. It serves a different purpose, so it shouldn’t be confused with RND.

An integer has no fractional part. A decimal value can include one, such as 18.75. Depending on the syntax being used, decimal generation can involve details such as decimal places or a range. Integer Syntax 1 is simpler: it uses RND with one parameter for length.

This difference is easy to overlook because both functions produce random numbers. But the expected format of the field should guide the choice. A whole-number quantity, for example, may call for an integer. A price or measurement may need a decimal value. Using the wrong kind of value can lead to confusing results—or to a test that doesn’t reflect how the application is meant to work.

Put the generated value in context

A random number is most useful when it fits the field where it will be used. A four-digit value might make sense for a field designed to accept a four-digit code. It might be a poor fit for an account identifier that must follow a specific pattern, or a quantity that has a strict business range.

Before using an expression, consider a few practical details:

  • What format does the field expect? Check its digit count and whether it accepts only whole numbers.

  • Does the field have a range rule? A digit length doesn’t automatically define the minimum and maximum allowed values.

  • Is the value meant to represent a real business item? Random data may not satisfy linked rules, such as a valid product, customer, or account record.

  • Will the value be recorded for later review? A changing input can make a failed run harder to reproduce unless the generated value is captured in the test results or logs.

That last point is worth keeping in mind. Random input adds variety, but variety can make a defect less obvious if no one can see what value caused it. Logging the generated value helps connect an unexpected result to its input. It’s a bit like noting the conditions around a faulty machine: without them, the same issue can be difficult to trace.

Length is useful—but it has limits

Choosing a digit count helps match the shape of an input, but it doesn’t guarantee that every generated value will be valid for a particular business process. An application may accept only numbers within a set range, reject certain patterns, or require a value to be unique. Those rules live at a different level from the length parameter.

For example, a system might accept a four-digit number only if it falls within a defined interval. {RND[4]} describes a four-digit integer; it does not communicate that interval. Likewise, it does not establish that the value is unused or tied to a valid record. Tosca’s random value can supply input, while the test design and application checks determine whether that input meets the wider requirements.

This is why test data should be considered as part of the application flow, not just as a string placed in a field. A number may look valid on screen and still fail a later check. Clear expectations make it easier to tell whether the issue lies in the data, the field, or the behavior being assessed.

Keep expressions clear and consistent

Readable expressions make automation easier to maintain. Use the function that matches the value type, enter a clear digit count, and keep the data rule close to the field or process that depends on it. If a team sees {RND[4]}, the intent is straightforward: generate an integer with four digits.

It also helps to avoid treating a random value as a substitute for meaningful data. Randomness can reveal how a system responds to variation, but it won’t automatically create realistic combinations. A valid order may depend on a real product, an available quantity, and a customer with the right status. Those relationships may need carefully defined test data rather than a handful of unrelated random numbers.

Used thoughtfully, though, random integers are a simple way to add variation to automated flows. The syntax itself is compact:


{RND[Length of random number]}

For a four-digit integer, the expression becomes:


{RND[4]}

Remember the central idea: RND generates an integer, and its single parameter sets the number of digits. Decimal values belong to a different function, and length should not be mistaken for a range. Once those points are clear, the expression is easy to read—and much easier to use in the right place.