Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d71ca9d

Browse files
committed
Never used the global, shared Random instance.
1 parent bba0bdf commit d71ca9d

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

Lib/statistics.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,13 +1788,9 @@ def kde_random(data, h, kernel='normal', *, seed=None):
17881788
if h <= 0.0:
17891789
raise StatisticsError(f'Bandwidth h must be positive, not {h=!r}')
17901790

1791-
if seed is None:
1792-
random = _random.random
1793-
choice = _random.choice
1794-
else:
1795-
prng = _random.Random(seed)
1796-
random = prng.random
1797-
choice = prng.choice
1791+
prng = _random.Random(seed)
1792+
random = prng.random
1793+
choice = prng.choice
17981794

17991795
try:
18001796
kernel_invcdf = _kernel_invcdfs[kernel]

0 commit comments

Comments
 (0)