-----------------------------------
The Talmud comments about the first verse in this week's Torah portion that if a woman seeds first, the child will be male and if the man seeds first, the child will be female. This would seem to indicate that a couple's bedroom practices can be used to determine the gender of a child. However, it is blatantly obvious that such efforts would be pretty equivalent to flipping a coin.
Rabbi Shmuel of Lubavitch noted this and re-explained the Talmudic passage as follows:
The Talmud is not referring to a child's biological gender at all. Rather, the Talmud is referring to a child's soul level and is using the terms "male" and "female" as code terms to mean higher and lower soul levels. By a "male" soul, the Talmud means a higher leveled soul and by "female" soul, the Talmud means a lower leveled soul. Accordingly, in this sense there can be biological females who have a "male" souls and biological males that "female" souls.
What the Talmud is really saying is that a couple's bedroom practices can determine what level of soul is drawn down into a fetus. Drawing down a higher soul mostly depends on the man's spiritual refinement and consideration for his wife. If he reigns in his passions and selflessly holds off until his wife has been properly satisfied then a higher soul ensouls the fetus. If he's not holding on this level, then a lower soul does the ensouling.