This code randomises 12 tones into a structured prime, or original key.
Classical key scales are sequential, linear, determined by the proper intervals.
In the twelve-tone technique devised by Arnold Schoenberg, which I've adopted here, all 12 available notes are randomly arranged in the prime scale.
This prime is programatically transformed three ways: inverted, inverted reverse and reverse, as outlined below. Only the prime and reverse works at the moment.