Creating a Random Number datasource

You can create a random number datasource in Rational® Performance Tester to assign unique random numbers to all the virtual users in a test. This datasource can generate unique integers or floating-point numbers for the virtual users in the schedule. You can choose to distribute the numbers of the virtual users or clients in a uniform, normal, or negative exponential way.

Before you begin

You must have created a test.

Procedure

  1. Open the test from the Test Navigator pane, and then select the name of the test in Test Contents.
  2. Select Built-in Datasources from the Category drop-down list in Test Details.
  3. Select Random Number, and then click Add Built-in datasource.
    The Built-in-Datasource Selection Wizard is displayed.
  4. Enter a name for the datasource in the Name field.
  5. Select one of the following options to apply the distribution method for the random numbers from the Distribution section:
    • Uniform: Click this option to generate the random numbers with a uniform distribution. You can specify the minimum and maximum values for the generated numbers.

      The default minimum and maximum values are 0 and 100.

    • Normal: Click this option to generate the random numbers with a normal or Gaussian distribution. You can specify the average and the standard deviation for the generated numbers.

      The default average and standard deviation values are 1.0.

    • Negative Exponential: Click this option to generate the random numbers with an exponential distribution. You can specify the average for the generated numbers.

      The default average value is 1.0.

  6. Select one of the following options to apply the format for the random numbers from the Formatting Options section:
    • Common: Select this option to format the random number in decimal, hexadecimal, octal, or scientific notations.

      The Common option has the following fields to apply the format for the random numbers:

      Fields Description
      Floating point

      You can select this checkbox to generate the random number with a decimal point.

      Precision

      You can enter a number in this field to show the smallest change in the random number.

      For example, if you entered 3 as the value in the Precision field, then the generated random number is in the following format:

      42.000

      Note: The Precision field is enabled only when you select the Floating point checkbox.
      Format as

      You can choose an option from the Format as drop-down list to apply the selected format for the random number.

      When you select the Floating point checkbox, then the Format as field lists the following options:

      • Decimal
      • Scientific Notation
      • Scientific Notation Uppercase

      When you clear the Floating point field, then the Format as field lists the following options:

      • Decimal
      • Hexadecimal
      • Hexadecimal Uppercase
      • Octal
      Enable width control

      You can select this checkbox to control the width of the generated random number.

      Fixed width
      You can enter a number in this field to have a specified number of digits in the random number.
      Note: The Fixed width field is enabled only when you select the Enable width control checkbox.
      Zero-padded

      You can select this checkbox to fill the unused digits in the random number with zero.

      For example, if you selected the value as Hexadecimal for the Format as field, entered 4 as a value in the Fixed width field, and selected the Zero-padded checkbox, then the generated random number is displayed in the following format:

      004c

      Left-justified

      You can select this checkbox to align the random number from the left side.

      Note: The Zero-padded field is disabled when you select the Left-justified field.

      For example, if you selected the value as Hexadecimal for the Format as field, entered 4 as a value in the Fixed width field, and selected the Left-justified checkbox, then the generated random number is displayed in the following format:

      4c

    • Custom: Select this option to specify the custom format for the random number.

      The Custom option has the following field:

      Format mask: You can enter a standard Java formatting syntax in this field to apply the format for the random number.

    Note: You can preview the changes in the Formatted output field based on your selection of the fields.
  7. Select the Get new value each time used checkbox to substitute the built-in datasource every time with a new random number for the requests.
  8. Click Finish.

Results

You have created the random number datasource for the test.

What to do next

You can assign random numbers to virtual users in the schedule by using an environmental variable. See Assigning random numbers to virtual users.