After the flood, God proclaimed that He would not intervene to judge the earth again for sin; that things would continue without Him punishing men during their mortal lives. Yet He did punish some men for their sin during their mortal lives. The key to this is understanding that when He changed His ‘modus operandi,” He always forewarned and explained what and why He was judging them.
So as event unfolded on earth, randomness ruled. With that randomness, vanity was always the result. That vanity is the normal state of being in the dispensation of grace, with randomness accounting for what most Christians believe is God’s blessing or judgements.
God’s one intervention on the earth that saves us mentally and spiritually from that ruling vanity was the death, burial and resurrection of His son, Jesus Christ. Faith in that saves us from vanity by giving us hope of the redemption of our bodies and an eternal purpose in Christ.