I picked up different approaches over time. There are a lot of resources out there, and the nice thing about Max is it's super easy to just load up an example file. I think I learned how to make a 1st order markov chain just by using Max's internal search function. I'm still learning things as well; it's been a slow process for me. The earliest thing I recall doing is using random~ and moses~ in Pure Data to sequence midi notes with weighted probability. This was a few years before I ever got a Max license. In a way, I haven't really strayed too far from that approach. I've used 'normal' step sequencers in max, along with probabilistic/algorithmic approaches for both rhythm and melody.
Fwiw about 1/2 of my tracks on GeODE were hand-sequenced in Reaper.