A very common problem - generate a set of random values in some range in accordance with the probability function, defined over this space. In this video, I will explain one of the best algorithms for generating such a random set with a weighted function, which is most optimal for the 1D cases.
Read about the full code here: http://mycoding.uk/a/generating_rando...