Want to have a baby boy? Tuck into the burgers, fries and ice cream. Want a girl? Then go on a diet and lose some weight.
It works for cows, according to John Roche, a scientist at New Zealand's dairy research organisation Dexcel. "And we would expect what holds true for one mammal will hold true across the board," he said.
Dexcel and Ireland's Teagasc agricultural organisation studied 1,200 cows in an 18-year research project from 1986 to 2004.
They found that cows that gained weight before conceiving were more likely to give birth to bull calves. Those shedding kilos before conception had a better chance of producing heifers (females).
Roche told the Waikato Times, published in Hamilton at the heart of New Zealand dairying country, the research underlined the theory that humans had some control over the sex of their children.
"Many theories have been put forward," he said, citing weather patterns, phases of the moon, bathing rituals and the timing of intercourse.
"However, there has been little consistent scientific evidence till now."
Roche said it was not clear exactly why weight affected the sex of a cow's offspring.
Although the male determined the sex of the embryo at conception, the female had some control over whether to keep a male or a female one.
"It's an evolutionary adaptation," he said. "In the wild, males compete with each other for a partner and the bigger male has a distinct advantage.
"Female size is not as crucial. Therefore, any particular maternal characteristic that results in a larger offspring is likely to produce more males.
"If anything reduces the size of the offspring at birth, it is a disadvantage to the individual to be born male - therefore, there is a greater probability of it being female."
Roche said a cow losing weight before conception may have some mechanism that prompted it to reject a male embryo because it was not up to supporting the development of a bull calf.