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
5425a673
Kaydet (Commit)
5425a673
authored
Ara 20, 2006
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Bug #1590891: random.randrange don't return correct value for big number
üst
e65f14fc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
random.py
Lib/random.py
+1
-1
test_random.py
Lib/test/test_random.py
+8
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/random.py
Dosyayı görüntüle @
5425a673
...
...
@@ -205,7 +205,7 @@ class Random(_random.Random):
raise
ValueError
,
"empty range for randrange()"
if
n
>=
maxwidth
:
return
istart
+
self
.
_randbelow
(
n
)
return
istart
+
istep
*
self
.
_randbelow
(
n
)
return
istart
+
istep
*
int
(
self
.
random
()
*
n
)
def
randint
(
self
,
a
,
b
):
...
...
Lib/test/test_random.py
Dosyayı görüntüle @
5425a673
...
...
@@ -439,6 +439,14 @@ class MersenneTwister_TestBasicOps(TestBasicOps):
self
.
assertEqual
(
k
,
numbits
)
# note the stronger assertion
self
.
assert_
(
2
**
k
>
n
>
2
**
(
k
-
1
))
# note the stronger assertion
def
test_randrange_bug_1590891
(
self
):
start
=
1000000000000
stop
=
-
100000000000000000000
step
=
-
200
x
=
self
.
gen
.
randrange
(
start
,
stop
,
step
)
self
.
assert_
(
stop
<
x
<=
start
)
self
.
assertEqual
((
x
+
stop
)
%
step
,
0
)
_gammacoeff
=
(
0.9999999999995183
,
676.5203681218835
,
-
1259.139216722289
,
771.3234287757674
,
-
176.6150291498386
,
12.50734324009056
,
-
0.1385710331296526
,
0.9934937113930748e-05
,
0.1659470187408462e-06
)
...
...
Misc/NEWS
Dosyayı görüntüle @
5425a673
...
...
@@ -12,6 +12,8 @@ What's New in Python 2.5.1c1?
Core and builtins
-----------------
- Bug #1590891: random.randrange don'
t
return
correct
value
for
big
number
-
Bug
#
1456209
:
In
some
obscure
cases
it
was
possible
for
a
class
with
a
custom
``
__eq__
()``
method
to
confuse
set
internals
when
class
instances
were
used
as
a
set
's elements and the ``__eq__()`` method mutated the set.
...
...
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