Cadences

A cadence is a harmonization of one of the melodic cadences:

                (all of the above in minor or Major scales)

SI/RE - DO should be harmonized as V/V7/vii/vii7♭ - I/i with any fitting triad for LA/MI/MI♭. The fuller the harmony, the better the cadence. Components may be missing, e.g. I/i may be reduced to tonic only, V7 played without third or fifth – and the grade of the cadence reduced accordingly.
Such cadences may appear by chance in the counterpoint – they are not part of the design. However, if none is found, the program will fail, and restart with a different random seed.
The common melodic cadences DO SI DO and DO RE DO may also be there, although a single melodic dodecaphonic line should not contain them. In any case, I ignore DO SI DO and DO RE DO.

Notice that the cadence harmony is not influenced by the noise_ parameter (the overall harmony chosen). A cadence is always a tonal cadence.