Somewhat off-topic, but I take it figuring out how to limit the number of dwarves in a migration wave in a similar manner is next-to-impossible?
Hum. No, should be possible. All of the size-of-wave inputs have to eventually mix together and digest into a low limit and a high limit. Find those, override them, and you're done. Or find the actual random number roll, override that, and get exactly as many as you want, every time.
It's just nobody has ever done it.
I'd think that there are some sort of hard limits in there, the obvious being zero for the low. The high would be something in the 20s? I've never seen a wave bigger than 23 or so dwarves, but how would one go about finding what those are and where they happen to be?
I would personally start by putting a breakpoint on the increase-experience routine, tripping only on gains of 500 points. (When new units are created with nonzero skills, they get multiples of 500. Except during embark, when they get exactly enough to hit the minimum for the skill level you choose.) I've found that routine in the past, I could find it again pretty easily.
Then I'd wait for a wave. Ignoring traders, diplomats, thieves/snatchers, and invading armies, which will also trip that breakpoint.
Statistically, it's pretty much guaranteed that one of the immigrants will trip the breakpoint. From that, I get a call stack which gets me a tree of caller routines. Then I just disable the 500 exp breakpoint and set new breakpoints on about 5 levels of the call tree, at the entry point of each procedure.
Then I just break&run until I get a sense of which routines get called for each new unit.
Find the topmost routine that is called to create each new unit, then look at its caller. There should be a loop right there. Find the loop control variable, look at how it gets set, figure out the random number generation (which, due to optimization, is very hard to do), and the two inputs to that are the low and high limits.
There would be difficulties along the way, but that's basically what I envision.