Simplify rnd algorithm, midi_gate program change cleanup