The maxrunsize attribute specifies the maximum number of consecutive times a given value can be randomly selected from a list.
<list>
integer expression | 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>