mirror of https://github.com/python/cpython
The stdev calculation is more accurate computing its own mean (#92220)
This commit is contained in:
parent
9b027d4cea
commit
ec8d3adb99
|
@ -1173,8 +1173,7 @@ class NormalDist:
|
|||
"Make a normal distribution instance from sample data."
|
||||
if not isinstance(data, (list, tuple)):
|
||||
data = list(data)
|
||||
xbar = fmean(data)
|
||||
return cls(xbar, stdev(data, xbar))
|
||||
return cls(mean(data), stdev(data))
|
||||
|
||||
def samples(self, n, *, seed=None):
|
||||
"Generate *n* samples for a given mean and standard deviation."
|
||||
|
|
Loading…
Reference in New Issue