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
ef4d4bdc
Kaydet (Commit)
ef4d4bdc
authored
May 23, 2002
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Whitespace normalized.
üst
b66e1a3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
random.py
Lib/random.py
+11
-11
No files found.
Lib/random.py
Dosyayı görüntüle @
ef4d4bdc
...
@@ -117,7 +117,7 @@ class Random:
...
@@ -117,7 +117,7 @@ class Random:
Class Random can also be subclassed if you want to use a different basic
Class Random can also be subclassed if you want to use a different basic
generator of your own devising: in that case, override the following
generator of your own devising: in that case, override the following
methods: random(), seed(), getstate(), setstate() and jumpahead().
methods: random(), seed(), getstate(), setstate() and jumpahead().
"""
"""
VERSION
=
1
# used by getstate/setstate
VERSION
=
1
# used by getstate/setstate
...
@@ -374,7 +374,7 @@ class Random:
...
@@ -374,7 +374,7 @@ class Random:
"""Normal distribution.
"""Normal distribution.
mu is the mean, and sigma is the standard deviation.
mu is the mean, and sigma is the standard deviation.
"""
"""
# mu = mean, sigma = standard deviation
# mu = mean, sigma = standard deviation
...
@@ -401,7 +401,7 @@ class Random:
...
@@ -401,7 +401,7 @@ class Random:
If you take the natural logarithm of this distribution, you'll get a
If you take the natural logarithm of this distribution, you'll get a
normal distribution with mean mu and standard deviation sigma.
normal distribution with mean mu and standard deviation sigma.
mu can have any value, and sigma must be greater than zero.
mu can have any value, and sigma must be greater than zero.
"""
"""
return
_exp
(
self
.
normalvariate
(
mu
,
sigma
))
return
_exp
(
self
.
normalvariate
(
mu
,
sigma
))
...
@@ -417,7 +417,7 @@ class Random:
...
@@ -417,7 +417,7 @@ class Random:
Deprecated in version 2.3. Use:
Deprecated in version 2.3. Use:
(mean + arc * (Random.random() - 0.5))
%
Math.pi
(mean + arc * (Random.random() - 0.5))
%
Math.pi
"""
"""
# mean: mean angle (in radians between 0 and pi)
# mean: mean angle (in radians between 0 and pi)
# arc: range of distribution (in radians between 0 and pi)
# arc: range of distribution (in radians between 0 and pi)
...
@@ -436,7 +436,7 @@ class Random:
...
@@ -436,7 +436,7 @@ class Random:
lambd is 1.0 divided by the desired mean. (The parameter would be
lambd is 1.0 divided by the desired mean. (The parameter would be
called "lambda", but that is a reserved word in Python.) Returned
called "lambda", but that is a reserved word in Python.) Returned
values range from 0 to positive infinity.
values range from 0 to positive infinity.
"""
"""
# lambd: rate lambd = 1/mean
# lambd: rate lambd = 1/mean
# ('lambda' is a Python reserved word)
# ('lambda' is a Python reserved word)
...
@@ -451,12 +451,12 @@ class Random:
...
@@ -451,12 +451,12 @@ class Random:
def
vonmisesvariate
(
self
,
mu
,
kappa
):
def
vonmisesvariate
(
self
,
mu
,
kappa
):
"""Circular data distribution.
"""Circular data distribution.
mu is the mean angle, expressed in radians between 0 and 2*pi, and
mu is the mean angle, expressed in radians between 0 and 2*pi, and
kappa is the concentration parameter, which must be greater than or
kappa is the concentration parameter, which must be greater than or
equal to zero. If kappa is equal to zero, this distribution reduces
equal to zero. If kappa is equal to zero, this distribution reduces
to a uniform random angle over the range 0 to 2*pi.
to a uniform random angle over the range 0 to 2*pi.
"""
"""
# mu: mean angle (in radians between 0 and 2*pi)
# mu: mean angle (in radians between 0 and 2*pi)
# kappa: concentration parameter kappa (>= 0)
# kappa: concentration parameter kappa (>= 0)
...
@@ -590,7 +590,7 @@ class Random:
...
@@ -590,7 +590,7 @@ class Random:
slightly faster than the normalvariate() function.
slightly faster than the normalvariate() function.
Not thread-safe without a lock around calls.
Not thread-safe without a lock around calls.
"""
"""
# When x and y are two variables from [0, 1), uniformly
# When x and y are two variables from [0, 1), uniformly
...
@@ -641,9 +641,9 @@ class Random:
...
@@ -641,9 +641,9 @@ class Random:
Conditions on the parameters are alpha > -1 and beta} > -1.
Conditions on the parameters are alpha > -1 and beta} > -1.
Returned values range between 0 and 1.
Returned values range between 0 and 1.
"""
"""
# This version due to Janne Sinkkonen, and matches all the std
# This version due to Janne Sinkkonen, and matches all the std
# texts (e.g., Knuth Vol 2 Ed 3 pg 134 "the beta distribution").
# texts (e.g., Knuth Vol 2 Ed 3 pg 134 "the beta distribution").
y
=
self
.
gammavariate
(
alpha
,
1.
)
y
=
self
.
gammavariate
(
alpha
,
1.
)
...
@@ -667,7 +667,7 @@ class Random:
...
@@ -667,7 +667,7 @@ class Random:
"""Weibull distribution.
"""Weibull distribution.
alpha is the scale parameter and beta is the shape parameter.
alpha is the scale parameter and beta is the shape parameter.
"""
"""
# Jain, pg. 499; bug fix courtesy Bill Arms
# Jain, pg. 499; bug fix courtesy Bill Arms
...
...
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