Good riff is subjective but I do get my riffs from jamming.
I don't have a band, so I always jam by myself. I never jam to a tape to find new riffs, I just fool around with notes.
I also never rely on scales, I just let the feeling drive me. The main thing I do is find a good riff, record it and then add another guitar.
It maybe a weird way of doing things but it does work great for me.
I do try numerous ways of picking swhen I get a good riff, just to see if I can make it better.
I also would quote James Hetfield who found the riff of Nothing else matter while talking on the phone!!!!!!!!! Pretty neat.