]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Reduce overhead on random timings (GH-24455)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Fri, 5 Feb 2021 05:36:03 +0000 (21:36 -0800)
committerGitHub <noreply@github.com>
Fri, 5 Feb 2021 05:36:03 +0000 (21:36 -0800)
Lib/random.py

index 187b0a016947a89cea0760007f1d9f344893c03f..0df26645d9e19e82d17711a2e18a1a24be616c01 100644 (file)
@@ -881,7 +881,7 @@ def _test_generator(n, func, args):
     from time import perf_counter
 
     t0 = perf_counter()
-    data = [func(*args) for i in range(n)]
+    data = [func(*args) for i in _repeat(None, n)]
     t1 = perf_counter()
 
     xbar = mean(data)