For sampling values from an arbitrary probability distribution function
Also called the acceptance-rejection method.