Fixed a bug in sample_from_cdf, that affected mating.