Here are my thoughts about what can influence the sex of cannabis plants.
Theoretical when you buy a pack of seeds from a quality seed bank you should, on average, end up with 50% female plants and 50% male plants when you grow your seeds. Sometimes this ratio may vary and you may end up with more females then males which is more often than not the norm, or the plants may all be of the same sex. What are the naturally occouring factors that influence this ratio?
If the seeds were not deliberately bred by the breeder to be all female (by crossing hermaphrodite female plants with pure female plants) then the only sex determining factors that remain are environmental. These remaining factors can be listed as follows:
1 .Nutrient concentrations and PH of the soil or grow media
2. Length of the nights or light cycles and quality of light
3 .Location of the population and the density of plants in that location.
All of the above can affect the ratio of male/female plants in a cannabis population. The purpose or reason if you like, of a cannabis plant's existence is the same as all other life on this planet, (including humans), reproduction! They exist and grow only to reproduce and pass genetic material on to the next generation of offspring thereby perpetuating the existence of the species.
Cannabis plants that are growing wild in an area where soil quality is poor, water is scarce and or there are so many plants that overcrowding and root binding is a problem, should theoretically tend towards a higher male ratio among the population. The logic behind this theory is that a higher ratio of male plants will give the population greater mobility. The wind may carry the pollen from the taller male plants to a female plant in another location, sometimes many kilometres from the original location of the male plant, thereby allowing the next generation of the population a chance at finding a more suitable location to grow and joining a new gene pool. Similarly, the same could be said of a population that is growing in a shady area where the amount of direct sun light they receive each day is limited. Plants that receive little direct sun light will stretch in an effort to reach the light source. This may also cause sex reversal in cannabis plants and result in taller plants that have a greater chance to spread their pollen and thus, the genes of the population. A population that is growing in an area where the soil is very fertile, rain fall is good and the environmental conditions are luxurious (from the plants perspective) should tend towards a higher ratio of female plants.
This theory does not mean that it's impossible to grow a female cannabis plant in poor quality soil in a shady location, just that the chances of a plant grown from seed being female will be increased if the growing conditions are favourable. Of couse, I could be wrong