It is random. Like the vast majority of everything else, it's ruled by a mean time to happen. Specifically, this one is governed by the months variable in \events\job_chancellor.txt, line 308. The default is 360, so on average it'll take 30 years for a chancellor (or master of laws, in this case) with a diplomacy skill of 6 - 9, longer if he has less, and increasingly shorter if he has more. Reduce that number and it'll probably happen faster. I say probably because, well, it's a probability. You may still have to wait a century if you get unlucky, that's just how it works; you're not guaranteed to ever have it happen, in the worst case (although that's so unlikely you probably have a better chance of winning the lottery two drawings in a row).