Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c4e4f96a
Commit
c4e4f96a
authored
Nov 13, 2016
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typos
parent
d0710a94
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
Lib/random.py
Lib/random.py
+1
-1
Lib/test/test_random.py
Lib/test/test_random.py
+1
-1
Misc/NEWS
Misc/NEWS
+1
-1
No files found.
Lib/random.py
View file @
c4e4f96a
...
...
@@ -352,7 +352,7 @@ class Random(_random.Random):
return
[
population
[
_int
(
random
()
*
total
)]
for
i
in
range
(
k
)]
cum_weights
=
list
(
_itertools
.
accumulate
(
weights
))
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
):
raise
ValueError
(
'The number of weights does not match the population'
)
bisect
=
_bisect
.
bisect
...
...
Lib/test/test_random.py
View file @
c4e4f96a
...
...
@@ -630,7 +630,7 @@ class MersenneTwister_TestBasicOps(TestBasicOps, unittest.TestCase):
self
.
assertEqual
((
x
+
stop
)
%
step
,
0
)
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
n
=
13132817
...
...
Misc/NEWS
View file @
c4e4f96a
...
...
@@ -123,7 +123,7 @@ Library
by
representing
the
scale
as
float
value
internally
in
Tk
.
tkinter
.
IntVar
now
works
if
float
value
is
set
to
underlying
Tk
variable
.
-
Issue
#
18844
:
The
various
ways
of
specifing
weights
for
random
.
choices
()
-
Issue
#
18844
:
The
various
ways
of
specif
y
ing
weights
for
random
.
choices
()
now
produce
the
same
result
sequences
.
-
Issue
#
28255
:
calendar
.
TextCalendar
().
prmonth
()
no
longer
prints
a
space
...
...
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