There's no secret technique. That's just my pick-up-a-guitar and fuck-around-with-it style of playing. That whole riff was just a mistake-a joke, really. To this day, I find it incredibly ironic and hilarious that it turned into a song, especially such a successful one. The riff started out as a stupid exercise that I noodled around with nearly every time I picked up a guitar. I don't really know how to practice properly, so I like to make up things that are difficult to play, so that I can become better at what I do.
Anyway, I must have played that riff a million times without ever thinking it would be a song. Then one day, while I was playing the riff, Izzy [Stradlin, former Guns N' Roses guitarist] started playing some chords, and the thing just took off! I think that just goes to show the value of doing things on the guitar that get you out of the box.