The maxRunSize attribute specifies the maximum number of consecutive times a given value can be randomly selected from a list.
<list>
Name | Type | Description |
---|---|---|
integer | value | An expression that can be converted to an integer value. |
The maxRunSize attribute places a constraint on random selection to ensure that a given item isn't selected multiple times in a row. If set to 1, for example, maxRunSize ensures that no value is selected twice or more in a row. A value of 2 would prevent runs of 3 or greater. By default, runs of any size are permitted. This attribute can only be specified if selectionMode is set to 'random'.
Random selection is done on the fly, so if multiple selection constraints such as not or replace are in place, it may not be possible to satisfy them all on a give trial, especially if there are only a few remaining items in the selection pool. In that case, the list will suspend one of the constraints and try again. If it still can not satisfy the remaining constraints, it suspends another and tries again, and so forth. By default, the maxRunSize constraint is suspended first, then replace, and finally the not constraints. If a procedure requires that the constraints always be satisfied, pregenerate a set of selection sequences that satisfy the constraints and then randomly select one of the pregenerated sequences to use for a given session.
The following sets the maxRunSize of a list to 1 to avoid any value being selected twice in a row:
<list selector>
/ selectionMode = random
/ maxRunSize = 1
/ items = [1; 2; 3; 4; 5]
</list>