The formula for potential stat gain is bugged
The formula used when you might gain an extra stat point depending on what your current stat amount is (primarily used when eating corpses) is buggy. Due to the way the checks are set up, you'll have a 100% chance of gaining a stat when you're at 28 of that stat, but only a 55% chance at 22 of that stat or 25% at 27 of the stat.
IIRC, this is because there is a bit that is supposed to only be run for 30+ of a stat that is also being run for 21+ of the stat, and they overlap awkwardly.