Statistical feedback algorithm in Ruby. Taken from Charles Ames' paper "Statistics and Compositional Balance," in Perspectives of New Music.