The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



NextCombination


Unit:SDL_dstruct
Class: none
Declaration: function NextCombination (var CurrentCombi: TCombination; MaxVal: integer): boolean;

The function NextCombination successively calculates all possible combinations of non-repeating digits with a predefined depth and width. The width of the combination (= the number of 'digits' in the combination) is defined by the element at address 0 of the array CurrentCombi (which can be seen as a string of 'digits' with its length byte at the position 0). The depth is defined by the parameter MaxVal (the digits may assume values between 1 and MaxVal ). MaxVal may take any value between CurrentCombi[0] and 255. NextCombination returns a TRUE value as long as there are further combinations available.

Note: In order to get the complete set of combinations, CurrentCombi should be initialized to the combination [1,2,3,..,x], with x being the width of the combination.



Last Update: 2023-Feb-06