jeudi 23 août 2018

Restricting numpy.random.lognormal to a given range, Python

I'm trying to sample a random number using a log normal distribution fitted to a data set of ages.

Age_abscess = numpy.random.lognormal(mean=numpy.log(29.9090909),
              sigma=numpy.log(11.6574484),size=None)

I sometimes get answers to the tune of something ^23 and smaller than 1. Given that I want these to be ages, is there a way to restrict the draw to be between 0 and 100?




Aucun commentaire:

Enregistrer un commentaire