The game tries to balance the genders at all times.
So if your game is filled with a lot of female sims, it's not unlikely that you'll get several boys in a row.
For example, I once read someone playing the 100 baby challenge kept getting girls because they added a lot of potential baby daddies from the gallery to the game.
I do believe the random npc generator takes this into account as well, but if your Sims stay on their home lot a lot, the game won't feel as much of a need to generate new randos as when you visit community lots a lot.