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

Skip to content

Commit f8a52d3

Browse files
committed
Removed deprecated functions
1 parent 02771c1 commit f8a52d3

2 files changed

Lines changed: 2 additions & 61 deletions

File tree

Doc/lib/librandom.tex

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,6 @@ \section{\module{random} ---
168168
Returned values range between 0 and 1.
169169
\end{funcdesc}
170170

171-
\begin{funcdesc}{cunifvariate}{mean, arc}
172-
Circular uniform distribution. \var{mean} is the mean angle, and
173-
\var{arc} is the range of the distribution, centered around the mean
174-
angle. Both values must be expressed in radians, and can range
175-
between 0 and \emph{pi}. Returned values range between
176-
\code{\var{mean} - \var{arc}/2} and \code{\var{mean} +
177-
\var{arc}/2} and are normalized to between 0 and \emph{pi}.
178-
179-
\deprecated{2.3}{Instead, use \code{(\var{mean} + \var{arc} *
180-
(random.random() - 0.5)) \% math.pi}.}
181-
\end{funcdesc}
182-
183171
\begin{funcdesc}{expovariate}{lambd}
184172
Exponential distribution. \var{lambd} is 1.0 divided by the desired
185173
mean. (The parameter would be called ``lambda'', but that is a

Lib/random.py

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545

4646
__all__ = ["Random","seed","random","uniform","randint","choice","sample",
4747
"randrange","shuffle","normalvariate","lognormvariate",
48-
"cunifvariate","expovariate","vonmisesvariate","gammavariate",
49-
"stdgamma","gauss","betavariate","paretovariate","weibullvariate",
48+
"expovariate","vonmisesvariate","gammavariate",
49+
"gauss","betavariate","paretovariate","weibullvariate",
5050
"getstate","setstate","jumpahead"]
5151

5252
NV_MAGICCONST = 4 * _exp(-0.5)/_sqrt(2.0)
@@ -308,29 +308,6 @@ def lognormvariate(self, mu, sigma):
308308
"""
309309
return _exp(self.normalvariate(mu, sigma))
310310

311-
## -------------------- circular uniform --------------------
312-
313-
def cunifvariate(self, mean, arc):
314-
"""Circular uniform distribution.
315-
316-
mean is the mean angle, and arc is the range of the distribution,
317-
centered around the mean angle. Both values must be expressed in
318-
radians. Returned values range between mean - arc/2 and
319-
mean + arc/2 and are normalized to between 0 and pi.
320-
321-
Deprecated in version 2.3. Use:
322-
(mean + arc * (Random.random() - 0.5)) % Math.pi
323-
324-
"""
325-
# mean: mean angle (in radians between 0 and pi)
326-
# arc: range of distribution (in radians between 0 and pi)
327-
import warnings
328-
warnings.warn("The cunifvariate function is deprecated; Use (mean "
329-
"+ arc * (Random.random() - 0.5)) % Math.pi instead",
330-
DeprecationWarning)
331-
332-
return (mean + arc * (self.random() - 0.5)) % _pi
333-
334311
## -------------------- exponential distribution --------------------
335312

336313
def expovariate(self, lambd):
@@ -465,27 +442,6 @@ def gammavariate(self, alpha, beta):
465442
break
466443
return x * beta
467444

468-
469-
def stdgamma(self, alpha, ainv, bbb, ccc):
470-
# This method was (and shall remain) undocumented.
471-
# This method is deprecated
472-
# for the following reasons:
473-
# 1. Returns same as .gammavariate(alpha, 1.0)
474-
# 2. Requires caller to provide 3 extra arguments
475-
# that are functions of alpha anyway
476-
# 3. Can't be used for alpha < 0.5
477-
478-
# ainv = sqrt(2 * alpha - 1)
479-
# bbb = alpha - log(4)
480-
# ccc = alpha + ainv
481-
import warnings
482-
warnings.warn("The stdgamma function is deprecated; "
483-
"use gammavariate() instead",
484-
DeprecationWarning)
485-
return self.gammavariate(alpha, 1.0)
486-
487-
488-
489445
## -------------------- Gauss (faster alternative) --------------------
490446

491447
def gauss(self, mu, sigma):
@@ -755,7 +711,6 @@ def _test(N=2000):
755711
_test_generator(N, 'random()')
756712
_test_generator(N, 'normalvariate(0.0, 1.0)')
757713
_test_generator(N, 'lognormvariate(0.0, 1.0)')
758-
_test_generator(N, 'cunifvariate(0.0, 1.0)')
759714
_test_generator(N, 'vonmisesvariate(0.0, 1.0)')
760715
_test_generator(N, 'gammavariate(0.01, 1.0)')
761716
_test_generator(N, 'gammavariate(0.1, 1.0)')
@@ -786,11 +741,9 @@ def _test(N=2000):
786741
shuffle = _inst.shuffle
787742
normalvariate = _inst.normalvariate
788743
lognormvariate = _inst.lognormvariate
789-
cunifvariate = _inst.cunifvariate
790744
expovariate = _inst.expovariate
791745
vonmisesvariate = _inst.vonmisesvariate
792746
gammavariate = _inst.gammavariate
793-
stdgamma = _inst.stdgamma
794747
gauss = _inst.gauss
795748
betavariate = _inst.betavariate
796749
paretovariate = _inst.paretovariate

0 commit comments

Comments
 (0)