By the words "the will of God," the apostle shows either that our sufferings do not occur without the providence of God, but are sent by Him as a trial, or that, suffering for His will, we must entrust to Him also the ending of our sufferings. For He is faithful and true in His promises, and "will not allow us to be tempted beyond our strength" (1 Cor. 10:13). How then must one commit oneself to God? "By doing good," he says. What does this mean? It means to rely on God with humility, not to ascribe great value to one's own sufferings, but the more one suffers, the more one should consider one...self unworthy, saying to the Lord: "You are righteous in all that You have done to us" (Dan. 3:27). "Ungodly" and "sinner" differ from each other in that the ungodly person does not acknowledge God at all, while the sinner, having faith in God, disregards His law. However, one and the same person can be both ungodly and a sinner. For in committing lawlessness, he undoubtedly acts impiously, not thinking, during the time of sin, about the existence of God (Ps. 9:25).
Source: Commentary on 1 Peter