summaryrefslogtreecommitdiffstats
path: root/Lib/random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2014-05-14 05:13:40 (GMT)
committerRaymond Hettinger <python@rcn.com>2014-05-14 05:13:40 (GMT)
commit23042cda40bdab21db36a92d5d2655046207f947 (patch)
treeef81353c09168980500d5d4d67590131280657e9 /Lib/random.py
parent2f46a0e8bef2e0a29e032ef805e9a95924af00a7 (diff)
downloadcpython-23042cda40bdab21db36a92d5d2655046207f947.zip
cpython-23042cda40bdab21db36a92d5d2655046207f947.tar.gz
cpython-23042cda40bdab21db36a92d5d2655046207f947.tar.bz2
Issue #21470: Do a better job seeding the random number generator
to fully cover its state space.
Diffstat (limited to 'Lib/random.py')
-rw-r--r--Lib/random.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/random.py b/Lib/random.py
index 808175a..174e755 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -105,7 +105,9 @@ class Random(_random.Random):
if a is None:
try:
- a = int.from_bytes(_urandom(32), 'big')
+ # Seed with enough bytes to span the 19937 bit
+ # state space for the Mersenne Twister
+ a = int.from_bytes(_urandom(2500), 'big')
except NotImplementedError:
import time
a = int(time.time() * 256) # use fractional seconds
en' name='h' value='hdf5_1_14_1'/>
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-03-24 23:18:34 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-03-24 23:18:34 (GMT)
commite987de2c42628f94e713111c5cbb09bbd3db4a68 (patch)
tree4baf097e2a0480c9cf24e2ce28749f969afb8fd8 /src/H5Dprivate.h
parent2ed9aa69f74cc2002fb9a03c8893056a1daea1db (diff)
downloadhdf5-e987de2c42628f94e713111c5cbb09bbd3db4a68.zip
hdf5-e987de2c42628f94e713111c5cbb09bbd3db4a68.tar.gz
hdf5-e987de2c42628f94e713111c5cbb09bbd3db4a68.tar.bz2
[svn-r329] Changes since 19980324
---------------------- ./src/H5D.c Zero element requests for H5Dread() and H5Dwrite() succeed. ./src/H5F.c ./src/H5Fprivate.h All files will have a root group. This greatly simplifies the library at the expense of ~1k extra bytes in files that have only one object. ./src/H5D.c ./src/H5Dprivate.h ./html/Groups.html Functions that used to take a file ID and an object name can now take a group ID instead of a file ID. This doesn't change the API, only it's documentation. ./src/H5G.c ./src/H5Gprivate.h ./src/H5O.c ./src/H5Oprivate.h Removed extra file arguments from some internal functions since the file pointer can be found from the group pointer or a symbol table entry (ent->file or H5G_fileof(group)). Besides, when we eventually implement mounting one file on another, H5G_namei() might return a different file than what you gave it, and that file is part of the returned symbol table entry. ./src/H5G.c Fixed bug with `.' appearing in a name. It used to hang the library. ./src/Makefile.in ./src/h5ls.c [NEW] ./MANIFEST Added `h5ls' a simple program that takes a file name and a directory and lists the contents of that directory using H5Giterate(). ./test/istore.c Changed an argument to H5G_create(). ./test/tstab.c Removed test_1 which was testing that files with a single object don't have a root group. This no longer applies.
Diffstat (limited to 'src/H5Dprivate.h')
-rw-r--r--src/H5Dprivate.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h