Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
f8a52d38
Kaydet (Commit)
f8a52d38
authored
Agu 05, 2003
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed deprecated functions
üst
02771c17
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
61 deletions
+2
-61
librandom.tex
Doc/lib/librandom.tex
+0
-12
random.py
Lib/random.py
+2
-49
No files found.
Doc/lib/librandom.tex
Dosyayı görüntüle @
f8a52d38
...
...
@@ -168,18 +168,6 @@ these equations can be found in any statistics text.
Returned values range between 0 and 1.
\end{funcdesc}
\begin{funcdesc}
{
cunifvariate
}{
mean, arc
}
Circular uniform distribution.
\var
{
mean
}
is the mean angle, and
\var
{
arc
}
is the range of the distribution, centered around the mean
angle. Both values must be expressed in radians, and can range
between 0 and
\emph
{
pi
}
. Returned values range between
\code
{
\var
{
mean
}
-
\var
{
arc
}
/2
}
and
\code
{
\var
{
mean
}
+
\var
{
arc
}
/2
}
and are normalized to between 0 and
\emph
{
pi
}
.
\deprecated
{
2.3
}{
Instead, use
\code
{
(
\var
{
mean
}
+
\var
{
arc
}
*
(random.random() - 0.5))
\%
math.pi
}
.
}
\end{funcdesc}
\begin{funcdesc}
{
expovariate
}{
lambd
}
Exponential distribution.
\var
{
lambd
}
is 1.0 divided by the desired
mean. (The parameter would be called ``lambda'', but that is a
...
...
Lib/random.py
Dosyayı görüntüle @
f8a52d38
...
...
@@ -45,8 +45,8 @@ from math import floor as _floor
__all__
=
[
"Random"
,
"seed"
,
"random"
,
"uniform"
,
"randint"
,
"choice"
,
"sample"
,
"randrange"
,
"shuffle"
,
"normalvariate"
,
"lognormvariate"
,
"
cunifvariate"
,
"
expovariate"
,
"vonmisesvariate"
,
"gammavariate"
,
"
stdgamma"
,
"
gauss"
,
"betavariate"
,
"paretovariate"
,
"weibullvariate"
,
"expovariate"
,
"vonmisesvariate"
,
"gammavariate"
,
"gauss"
,
"betavariate"
,
"paretovariate"
,
"weibullvariate"
,
"getstate"
,
"setstate"
,
"jumpahead"
]
NV_MAGICCONST
=
4
*
_exp
(
-
0.5
)
/
_sqrt
(
2.0
)
...
...
@@ -308,29 +308,6 @@ class Random(_random.Random):
"""
return
_exp
(
self
.
normalvariate
(
mu
,
sigma
))
## -------------------- circular uniform --------------------
def
cunifvariate
(
self
,
mean
,
arc
):
"""Circular uniform distribution.
mean is the mean angle, and arc is the range of the distribution,
centered around the mean angle. Both values must be expressed in
radians. Returned values range between mean - arc/2 and
mean + arc/2 and are normalized to between 0 and pi.
Deprecated in version 2.3. Use:
(mean + arc * (Random.random() - 0.5))
%
Math.pi
"""
# mean: mean angle (in radians between 0 and pi)
# arc: range of distribution (in radians between 0 and pi)
import
warnings
warnings
.
warn
(
"The cunifvariate function is deprecated; Use (mean "
"+ arc * (Random.random() - 0.5))
%
Math.pi instead"
,
DeprecationWarning
)
return
(
mean
+
arc
*
(
self
.
random
()
-
0.5
))
%
_pi
## -------------------- exponential distribution --------------------
def
expovariate
(
self
,
lambd
):
...
...
@@ -465,27 +442,6 @@ class Random(_random.Random):
break
return
x
*
beta
def
stdgamma
(
self
,
alpha
,
ainv
,
bbb
,
ccc
):
# This method was (and shall remain) undocumented.
# This method is deprecated
# for the following reasons:
# 1. Returns same as .gammavariate(alpha, 1.0)
# 2. Requires caller to provide 3 extra arguments
# that are functions of alpha anyway
# 3. Can't be used for alpha < 0.5
# ainv = sqrt(2 * alpha - 1)
# bbb = alpha - log(4)
# ccc = alpha + ainv
import
warnings
warnings
.
warn
(
"The stdgamma function is deprecated; "
"use gammavariate() instead"
,
DeprecationWarning
)
return
self
.
gammavariate
(
alpha
,
1.0
)
## -------------------- Gauss (faster alternative) --------------------
def
gauss
(
self
,
mu
,
sigma
):
...
...
@@ -755,7 +711,6 @@ def _test(N=2000):
_test_generator
(
N
,
'random()'
)
_test_generator
(
N
,
'normalvariate(0.0, 1.0)'
)
_test_generator
(
N
,
'lognormvariate(0.0, 1.0)'
)
_test_generator
(
N
,
'cunifvariate(0.0, 1.0)'
)
_test_generator
(
N
,
'vonmisesvariate(0.0, 1.0)'
)
_test_generator
(
N
,
'gammavariate(0.01, 1.0)'
)
_test_generator
(
N
,
'gammavariate(0.1, 1.0)'
)
...
...
@@ -786,11 +741,9 @@ sample = _inst.sample
shuffle
=
_inst
.
shuffle
normalvariate
=
_inst
.
normalvariate
lognormvariate
=
_inst
.
lognormvariate
cunifvariate
=
_inst
.
cunifvariate
expovariate
=
_inst
.
expovariate
vonmisesvariate
=
_inst
.
vonmisesvariate
gammavariate
=
_inst
.
gammavariate
stdgamma
=
_inst
.
stdgamma
gauss
=
_inst
.
gauss
betavariate
=
_inst
.
betavariate
paretovariate
=
_inst
.
paretovariate
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment