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
2ba3911d
Commit
2ba3911d
authored
May 13, 2014
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21470: Do a better job seeding the random number generator
to fully cover its state space.
parent
d4d7db31
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
Lib/random.py
Lib/random.py
+3
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/random.py
View file @
2ba3911d
...
...
@@ -108,7 +108,9 @@ class Random(_random.Random):
if
a
is
None
:
try
:
a
=
long
(
_hexlify
(
_urandom
(
32
)),
16
)
# Seed with enough bytes to span the 19937 bit
# state space for the Mersenne Twister
a
=
long
(
_hexlify
(
_urandom
(
2500
)),
16
)
except
NotImplementedError
:
import
time
a
=
long
(
time
.
time
()
*
256
)
# use fractional seconds
...
...
Misc/NEWS
View file @
2ba3911d
...
...
@@ -52,6 +52,9 @@ Library
-
Issue
#
21306
:
Backport
hmac
.
compare_digest
from
Python
3.
This
is
part
of
PEP
466.
-
Issue
#
21470
:
Do
a
better
job
seeding
the
random
number
generator
by
using
enough
bytes
to
span
the
full
state
space
of
the
Mersenne
Twister
.
-
Issue
#
21469
:
Reduced
the
risk
of
false
positives
in
robotparser
by
checking
to
make
sure
that
robots
.
txt
has
been
read
or
does
not
exist
prior
to
returning
True
in
can_fetch
().
...
...
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