The skill gain random quest does not properly consider the chance to learn each skill.
ToME 2.3.2 skills.c line 1311 is
if (!magik(s_info[i].random_gain_chance))
that line should be
if (!magik(s_info[available_skills[i]].random_gain_chance))
Without the translation from i to available_skills[i] it is considering the gain chance for skill i when it will eventually reward with available_skills[i]
GreyCat: I've applied this to tome_230_branch. Great catch! Did you just stumble across it while reading the code, or did you observe anomalous probabilities while playing?
DanRosenberry: I noticed it while reading the code. I dislike the forced randomness in that quest reward and have been tinkering with ways to improve it. I have noticed afterwards that Necromancy is less common (it's a 60% chance but it must have been getting 100% before).
Now I'm debating how long my sorcerers can hold off on buying Undead Form in order to maximize the chances at free points... Probably get me killed.
ToME Wiki