Description

The WeightGen Generator defines a percentage between 1 and 100 to determine how often values generated from variable1 will be selected over values generated from variable2. The variables can be a constant or referenced value (e.g., attribute, generator). 


Note: You can use the MultiWeightGen to enter multiple constant or referenced values and assign a percentage to each of those values. 


In This Example


Generator Parameters

The following parameters may be configured for the WeightGen Generator. Items with an asterisk* are required. 

  • percentage* - Defines the weight for selected variable1 over variable2.
  • variable1* - Defines a constant or reference to another generated value.
  • variable2* - Defines a constant or a reference to another generated value.
  • seed - Defines an optional seed for randomization.


Example 1 - Select Pass 70% of the Time

A tester wants to generate Pass/Fail values for an attribute but wants 'Pass' to be selected 70% of the time over 'Fail.' The following parameters have been configured for this example:

  • percentage =70
  • variable1 = Pass
  • variable 2 = Fail



Sample Output

Pass = 7 or 70%

Fail = 3 or 30%



Example 2 - Two Colors with Variable1 Color Chosen 25 Percent of the Time

For this example, two ListGen Generators have been linked to the WeightGen Generator. These two Generators generate one color: 

  • First Generator = green
  • Second Generator = red


The WeightGen Generator references these Generators for variable1 and variable2 and has been configured to choose variable1 25 percent of the time. 



First ListGen (gen1) Generator configuration: 



Second ListGen (gen2) Generator configuration: 



Sample Output