Skip to content

Commit c9118af

Browse files
authored
Small speed-up for NormalDist.samples (pythonGH-94730)
1 parent e8e4b55 commit c9118af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/statistics.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ def samples(self, n, *, seed=None):
11931193
"Generate *n* samples for a given mean and standard deviation."
11941194
gauss = random.gauss if seed is None else random.Random(seed).gauss
11951195
mu, sigma = self._mu, self._sigma
1196-
return [gauss(mu, sigma) for i in range(n)]
1196+
return [gauss(mu, sigma) for _ in repeat(None, n)]
11971197

11981198
def pdf(self, x):
11991199
"Probability density function. P(x <= X < x+dx) / dx"

0 commit comments

Comments
 (0)