Not long ago i had a strange erratic idle as well..also my check engine light would flash here and there..I found that it was my O2 sensor..i cant say thats what is wrong with yours but it is a possibility..when the light is on...try reving the engine to a high rpm quickly to see if the light shuts off..if so, the O2 is most likely junk. even after i bi-passed the O2 sensor..i noticed a better idle, not perfect, but better..