summaryrefslogtreecommitdiffstats
path: root/Lib/statistics.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2022-07-11 03:34:53 (GMT)
committerGitHub <noreply@github.com>2022-07-11 03:34:53 (GMT)
commitc9118afd045a64ca22d4a8cc5d43532607083b2d (patch)
treef5193c6d8163efd415f63f78326f0fc67976a758 /Lib/statistics.py
parente8e4b550f50e716c57cc5d0225042ab766c5582d (diff)
downloadcpython-c9118afd045a64ca22d4a8cc5d43532607083b2d.zip
cpython-c9118afd045a64ca22d4a8cc5d43532607083b2d.tar.gz
cpython-c9118afd045a64ca22d4a8cc5d43532607083b2d.tar.bz2
Small speed-up for NormalDist.samples (GH-94730)
Diffstat (limited to 'Lib/statistics.py')
-rw-r--r--Lib/statistics.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/statistics.py b/Lib/statistics.py
index 2d66b05..a2793d9 100644
--- a/Lib/statistics.py
+++ b/Lib/statistics.py
@@ -1193,7 +1193,7 @@ class NormalDist:
"Generate *n* samples for a given mean and standard deviation."
gauss = random.gauss if seed is None else random.Random(seed).gauss
mu, sigma = self._mu, self._sigma
- return [gauss(mu, sigma) for i in range(n)]
+ return [gauss(mu, sigma) for _ in repeat(None, n)]
def pdf(self, x):
"Probability density function. P(x <= X < x+dx) / dx"