It's just random luck like in Vegas, but it seems you can ask the house for a better hand by generally avoiding any source of stress for the seedlings especially in the two-three week period starting from the third set of leaves.
Here's some tips from Dutch Passion on how to increase the probability of females:
"From literature and our own findings it appears that the growth of a male or female plant from seed, except for the predisposition in the gender chromosomes, also depends on various environmental factors. The environmental factors that influence gender are:
1. Higher nitrogen concentration will give more females.
2. Fewer hours of light will give more females.
3. Higher humidity will give more females.
4. Lower temperature will give more females.
5. More blue light will give more females.
6. Higher potassium concentration will give more males.
Also, some people have other techniques for skewing the probability in favor of more females, for instance, exposing the seeds to ethylene gas from ripening bananas for a couple of weeks is supposed to actually feminized the seeds to the max allowed by the chromosomes.
Hope this helps