Weighted List

User Rating: / 3


The weighted list generation rule is probably one of the most popular and important generation rule available in GEDIS Studio.


As you are concerned with the realism of the test data you must fully understand the basics of values frequency control and the several features provided by the Weighted List rule to achieve this control.

The configuration is made with a sequence of values and for each value a weight. In the random mode, the weights will be used inform the generation engine on the expected frequency of the associated values in the generated data.

You can put only once a same value in the list and the associated weights must be a number greater than zero - otherwise they will be just ignored during initialization. Keep these constraints in mind especially if you plan to use parameters for values or weights.

There's an important point regarding frequency control.  To have an effective distribution of the values that matches your configuration you must produce a sufficient number of values. For example, it doesn't make sense to expect a uniform distribution between a thousand of values if you generate only a hundred of those values.

There are two other parameters made available to control how values are selected during the generation of your test data. The first is the type of selection and you can chose among sequence or random; and the second is a flag to activate or not the interpretation of generated values. We will see more about this later.

A Simple Default Configuration

Let's start with a simple case and consider you have a list of colors you want to choose from such as: blue, red, white, yellow and black. Notice that when adding a new value in the list, GEDIS Studio choses a default weight of 1 and provides a uniform disitribution of the values.

With this default configuration each value in the list will have the same chance to be selected. Assuming the default random selection type, you don't have any control on the order in which values will be selected in the list.

As we mentioned it before, the only expectation you can have with this configuration is that if you generate enough values, the relative frequency of each value will match the weight you provided for that value.

Using the Sequence Selection Type

Using the same configuration, you can use the selection type option and modify the way values are generated. By selecting the sequence selection type you ask the generation engine to produce values in the order of appearance in the configuration list. In such as case, the weight of a value is used to control the number of successive occurrences of that value.

For example, you change the previous configuration with new weights such as 1 for blue, 2 for red, 3 for white and so on. In that case, the generated values will look like the sequence:

blue, red, red, white, white, white, etc.

When reaching the last occurence of the last value, the generation will abort unless the box "Sequence with Loopback" is ticked.

Using expressions as values

If you ticked alos the box "Value as Expression", each value will be interpreted as an expression and will be evaluated each time the value is selected. For example, if you have a value defined with DEC(3) then a different 3 digit number will be generated for that value. 

Add comment

Security code