Commit fb8c7d53 authored by Raymond Hettinger's avatar Raymond Hettinger Committed by GitHub

bpo-36018: Make "seed" into a keyword only argument (GH-12921)

parent 72800486
...@@ -607,7 +607,7 @@ of applications in statistics. ...@@ -607,7 +607,7 @@ of applications in statistics.
:exc:`StatisticsError` because it takes at least one point to estimate :exc:`StatisticsError` because it takes at least one point to estimate
a central value and at least two points to estimate dispersion. a central value and at least two points to estimate dispersion.
.. method:: NormalDist.samples(n, seed=None) .. method:: NormalDist.samples(n, *, seed=None)
Generates *n* random samples for a given mean and standard deviation. Generates *n* random samples for a given mean and standard deviation.
Returns a :class:`list` of :class:`float` values. Returns a :class:`list` of :class:`float` values.
......
...@@ -797,7 +797,7 @@ class NormalDist: ...@@ -797,7 +797,7 @@ class NormalDist:
xbar = fmean(data) xbar = fmean(data)
return cls(xbar, stdev(data, xbar)) return cls(xbar, stdev(data, xbar))
def samples(self, n, seed=None): def samples(self, n, *, seed=None):
'Generate *n* samples for a given mean and standard deviation.' 'Generate *n* samples for a given mean and standard deviation.'
gauss = random.gauss if seed is None else random.Random(seed).gauss gauss = random.gauss if seed is None else random.Random(seed).gauss
mu, sigma = self.mu, self.sigma mu, sigma = self.mu, self.sigma
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment