Mutable-Instruments "Anushri" synthesizer has a nice built-in drum pattern generator ("generative sequencer").
I did steal the essential code and made a renoise tool out of it.
There is a lengthy description of how it works at: http://mutable-instruments.net/anushri/manual