From c9118afd045a64ca22d4a8cc5d43532607083b2d Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sun, 10 Jul 2022 22:34:53 -0500 Subject: Small speed-up for NormalDist.samples (GH-94730) --- Lib/statistics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" -- cgit v0.12