Adding a function tha generates a random number according with a histogram.