Good can come out of bad things and bad situations. When those of us who love God are tempted or troubled by ungodly thoughts, dont we better understand at that time more than any other the need for God?
Of course, when were in that state of temptation, we feel sad and we sigh and we pray, because were in misery. Then we get tired of being in misery, tired enough to make some changes that will set us free from that struggle.
So the tough times allow us to appreciate and grow toward more good times. They also toughen us to develop a resistance to sin sin that appears pleasurable, but ends in torment.
So, Ive got to be thankful that God has provided a way to deal with our temptations!