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
978c6abc
Kaydet (Commit)
978c6abc
authored
May 26, 2014
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 13355: Make random.triangular degrade gracefully when low == high.
üst
a2fc99ec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
random.py
Lib/random.py
+4
-1
test_random.py
Lib/test/test_random.py
+1
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/random.py
Dosyayı görüntüle @
978c6abc
...
...
@@ -355,7 +355,10 @@ class Random(_random.Random):
"""
u
=
self
.
random
()
c
=
0.5
if
mode
is
None
else
(
mode
-
low
)
/
(
high
-
low
)
try
:
c
=
0.5
if
mode
is
None
else
(
mode
-
low
)
/
(
high
-
low
)
except
ZeroDivisionError
:
return
low
if
u
>
c
:
u
=
1.0
-
u
c
=
1.0
-
c
...
...
Lib/test/test_random.py
Dosyayı görüntüle @
978c6abc
...
...
@@ -602,7 +602,7 @@ class TestDistributions(unittest.TestCase):
for
variate
,
args
,
expected
in
[
(
g
.
uniform
,
(
10.0
,
10.0
),
10.0
),
(
g
.
triangular
,
(
10.0
,
10.0
),
10.0
),
#
(g.triangular, (10.0, 10.0, 10.0), 10.0),
(
g
.
triangular
,
(
10.0
,
10.0
,
10.0
),
10.0
),
(
g
.
expovariate
,
(
float
(
'inf'
),),
0.0
),
(
g
.
vonmisesvariate
,
(
3.0
,
float
(
'inf'
)),
3.0
),
(
g
.
gauss
,
(
10.0
,
0.0
),
10.0
),
...
...
Misc/NEWS
Dosyayı görüntüle @
978c6abc
...
...
@@ -24,6 +24,9 @@ Library
- Issue #14710: pkgutil.find_loader() no longer raises an exception when a
module doesn'
t
exist
.
-
Issue
#
13355
:
random
.
triangular
()
no
longer
fails
with
a
ZeroDivisionError
when
low
equals
high
.
-
Issue
#
21538
:
The
plistlib
module
now
supports
loading
of
binary
plist
files
when
reference
or
offset
size
is
not
a
power
of
two
.
...
...
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