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
77f6411d
Kaydet (Commit)
77f6411d
authored
Kas 13, 2016
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge
üst
cf767ab4
24e42394
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
random.py
Lib/random.py
+1
-1
test_random.py
Lib/test/test_random.py
+1
-1
No files found.
Lib/random.py
Dosyayı görüntüle @
77f6411d
...
@@ -352,7 +352,7 @@ class Random(_random.Random):
...
@@ -352,7 +352,7 @@ class Random(_random.Random):
return
[
population
[
_int
(
random
()
*
total
)]
for
i
in
range
(
k
)]
return
[
population
[
_int
(
random
()
*
total
)]
for
i
in
range
(
k
)]
cum_weights
=
list
(
_itertools
.
accumulate
(
weights
))
cum_weights
=
list
(
_itertools
.
accumulate
(
weights
))
elif
weights
is
not
None
:
elif
weights
is
not
None
:
raise
TypeError
(
'Cannot specify both weights and cumulative
_
weights'
)
raise
TypeError
(
'Cannot specify both weights and cumulative
weights'
)
if
len
(
cum_weights
)
!=
len
(
population
):
if
len
(
cum_weights
)
!=
len
(
population
):
raise
ValueError
(
'The number of weights does not match the population'
)
raise
ValueError
(
'The number of weights does not match the population'
)
bisect
=
_bisect
.
bisect
bisect
=
_bisect
.
bisect
...
...
Lib/test/test_random.py
Dosyayı görüntüle @
77f6411d
...
@@ -626,7 +626,7 @@ class MersenneTwister_TestBasicOps(TestBasicOps, unittest.TestCase):
...
@@ -626,7 +626,7 @@ class MersenneTwister_TestBasicOps(TestBasicOps, unittest.TestCase):
self
.
assertEqual
((
x
+
stop
)
%
step
,
0
)
self
.
assertEqual
((
x
+
stop
)
%
step
,
0
)
def
test_choices_algorithms
(
self
):
def
test_choices_algorithms
(
self
):
# The various ways of specifing weights should produce the same results
# The various ways of specif
y
ing weights should produce the same results
choices
=
self
.
gen
.
choices
choices
=
self
.
gen
.
choices
n
=
13132817
n
=
13132817
...
...
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