How to generate a values using random.gauss in python for the range 0, 50 -
i confused concept of random.gauss() in python, explained gauss function takes mean , standard deviation parameter.
for instance if want generate random numbers in range 0-50 using gauss specifically, parameters. tried using mean , standard deviation of range 0-50. unfortunately not fetch me correct list.
a gaussian distribution infinite, can't generate numbers guaranteed between 2 boundaries. can set median 25 , standard deviation make unlikely number fall outside 0 or 50, of course it's tradeoff: either lower/higher numbers won't anywhere close 0/50, or there plenty of outliers.
in practice like:
random.gauss(25, 25/3)
and know 99.7% of results within 0 , 5 (+- 3 sigma mean). can avoid going out of bounds retrying if value above 50 or below 0, it's not gaussian anymore. may need though, enough approximation depending on you're trying model/simulate.
Comments
Post a Comment