jeudi 29 novembre 2018

Shouldn't random.gauss return values in between mean and the standard deviation?

I tried using the random.gauss function in Python to get a random value between a range. The gauss function takes mean, standard deviation as parameters. Shouldn't the return value be between [mean +- standard deviation]?

Below is the code snippet:

for y in [random.gauss(4,1) for _ in range(50)]:
    if y > 5 or y < 3: # shouldn't y be between  (3, 5) ?
        print(y)

Output of the code:

6.011096878888296
2.9192195126660403
5.020299287583643
2.9322959456674083
1.6704559841869528




Aucun commentaire:

Enregistrer un commentaire