I think it is random and not based on any characters lockpicking ability. And the EXP from the guards is better than any treasure I've found.