Ever wondered why some families seem to have only boys or only girls? Well, Harvard researchers were curious too. So they dug into birth records of over 58,000 female nurses in the US, born between 1956 and 2015, to figure out if it’s all random—or if there’s some science behind it.Here’s what they found: In families with just two kids, it was most common to have one boy and one girl. Classic balance, right? But when it came to families with three or more kids, things got a little more one-sided. Turns out, those families were more likely to have all boys or all girls, rather than a mix. So if you’ve already got three little dudes running around, science says baby number four is probably another dude.Now this gets quite interesting as you read it. The new Harvard study has found that the odds of having a baby of a particular gender might be lower if you already several kids of the opposite gender. In simple terms: In families with three boys, there is a 61% chance that the next sibling is male. For families with three girls, there was a 58% chance that the next child would be female. The findings of the study have been published in Science Advances.The findings challenge what people have been told about their baby’s sex, which is that for each pregnancy, there is an equal chance of having either a boy or a girl, says Alex Polyakov, an obstetrician and researcher at the University of Melbourne, Australia. “Based on these findings, you have to tell couples that their chance of having a different-sex child from what they already have is actually less than 50:50,” he told Nature.“If you’ve had two girls or three girls and you’re trying for a boy, you should know your odds are not 50-50,” said Jorge Chavarro, the study’s senior author told the Washington Post. “You’re more likely than not to have another girl.”And get this—your age when you start having kids might play a part too. Women who had their first child at 29 or older were 13% more likely to have all children of the same sex compared to women who started younger, like under 23.Why? One theory has to do with something you probably never thought about: vaginal pH. As women age, their body chemistry changes which might tip the scales in favor of either X-carrying sperm (girl) or Y-carrying sperm (boy). Basically, the sperm with the better chance in that environment gets to the egg first. Paternal factors could also play a role but the study did not include data on fathers, which was noted as a limitation.It might take years to fully understand why some families consistently have children of one sex, but this research is an important place to start, Chavarro told the media outlet.So next time you meet a family with four boys or four girls and no variety, it might not be a coincidence. It could be science doing its thing behind the scenes.