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
102d8749
Commit
102d8749
authored
May 05, 2011
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sync-up minor code edits with the default branch.
parent
f90ba8a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Lib/random.py
Lib/random.py
+4
-4
No files found.
Lib/random.py
View file @
102d8749
...
@@ -42,7 +42,7 @@ from types import MethodType as _MethodType, BuiltinMethodType as _BuiltinMethod
...
@@ -42,7 +42,7 @@ from types import MethodType as _MethodType, BuiltinMethodType as _BuiltinMethod
from
math
import
log
as
_log
,
exp
as
_exp
,
pi
as
_pi
,
e
as
_e
,
ceil
as
_ceil
from
math
import
log
as
_log
,
exp
as
_exp
,
pi
as
_pi
,
e
as
_e
,
ceil
as
_ceil
from
math
import
sqrt
as
_sqrt
,
acos
as
_acos
,
cos
as
_cos
,
sin
as
_sin
from
math
import
sqrt
as
_sqrt
,
acos
as
_acos
,
cos
as
_cos
,
sin
as
_sin
from
os
import
urandom
as
_urandom
from
os
import
urandom
as
_urandom
import
collections
as
_collections
from
collections
import
Set
as
_Set
,
Sequence
as
_Sequence
from
hashlib
import
sha512
as
_sha512
from
hashlib
import
sha512
as
_sha512
__all__
=
[
"Random"
,
"seed"
,
"random"
,
"uniform"
,
"randint"
,
"choice"
,
"sample"
,
__all__
=
[
"Random"
,
"seed"
,
"random"
,
"uniform"
,
"randint"
,
"choice"
,
"sample"
,
...
@@ -293,10 +293,10 @@ class Random(_random.Random):
...
@@ -293,10 +293,10 @@ class Random(_random.Random):
# preferred since the list takes less space than the
# preferred since the list takes less space than the
# set and it doesn't suffer from frequent reselections.
# set and it doesn't suffer from frequent reselections.
if
isinstance
(
population
,
_
collections
.
Set
):
if
isinstance
(
population
,
_Set
):
population
=
tuple
(
population
)
population
=
tuple
(
population
)
if
not
isinstance
(
population
,
_
collections
.
Sequence
):
if
not
isinstance
(
population
,
_Sequence
):
raise
TypeError
(
"Population must be a sequence or
S
et. For dicts, use list(d)."
)
raise
TypeError
(
"Population must be a sequence or
s
et. For dicts, use list(d)."
)
randbelow
=
self
.
_randbelow
randbelow
=
self
.
_randbelow
n
=
len
(
population
)
n
=
len
(
population
)
if
not
0
<=
k
<=
n
:
if
not
0
<=
k
<=
n
:
...
...
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