Many Christians find comfort through their trials and tribulations in James' words recorded in James 1:2-4...
"Count it all joy, my brothers, when you meet trials of various kinds, for you know that the testing of your faith produces steadfastness. And let steadfastness have its full effect, that you may be perfect and complete, lacking in nothing."
Their thinking goes like this: The Lord uses our trials to discipline us and to shape us; therefore, whenever we experience trials we grow in righteousness. Ideally, that's true, but it's not an automatic. The author of Hebrews tells us (Heb. 12:11)...
"For the moment all discipline seems painful rather than pleasant, but later it yields the peaceful fruit of righteousness to those who have been trained by it."
Did you catch that last phrase? "...to those who have been trained by it."
Our trouble (including our discipline) can produce righteousness within us, but only if we allow ourselves to be "trained by it," i.e., if we accept it and look to God for His will in and through it. If we reject the trouble in our life, as though we were undeserving of it, we will not become righteous as a result, but rather we will become resentful.