Permutation: Swap one from range...

An element at an index, randomly chosen from a range, will be permuted with an element at a prescribed index position.

Settings

Index range
defines the range of indices from which one will be randomly chosen.
Index
defines the special index position whose element will be interchanged with the one chosen from the range.
Forbid same
when on, forbids the randomly chosen position and the index position to be the same. This switch is only of relevance when the chosen range happens to overlap the index position.

Examples

With Index range = [0,0], Index = 3, Forbid same is off and (1,2,3,4,5) as the starting permutation, the outcome might be one of the five permutations (3,2,1,4,5), (1,3,2,4,5), (1,2,3,4,5), (1,2,4,3,5), (1,2,5,4,3). If Forbid same were chosen as on, the (1,2,3,4,5) permutation is forbidden and the outcome could only be one of the four remaining permutations.

Links to this page


© djmw, January 5, 2011