summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-10-05 09:09:15 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-10-05 09:09:15 (GMT)
commit2f726e9093381572b21edbfc42659ea89fbdf686 (patch)
tree9625e748344e1709fc69a8b98298efdd602b4cc2 /Misc
parent5c68ef04b7f0c0c1d342647a7db2d3f76637d3fa (diff)
downloadcpython-2f726e9093381572b21edbfc42659ea89fbdf686.zip
cpython-2f726e9093381572b21edbfc42659ea89fbdf686.tar.gz
cpython-2f726e9093381572b21edbfc42659ea89fbdf686.tar.bz2
SF bug #812202: randint is always even
* Added C coded getrandbits(k) method that runs in linear time. * Call the new method from randrange() for ranges >= 2**53. * Adds a warning for generators not defining getrandbits() whenever they have a call to randrange() with too large of a population.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS8
1 files changed, 8 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index f4ca158..5a8379e 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -84,6 +84,14 @@ Library
seed. Modified to match Py2.2 behavior and use fractional seconds so
that successive runs are more likely to produce different sequences.
+- random.Random has a new method, getrandbits(k), which returns an int
+ with k random bits. This method is now an optional part of the API
+ for user defined generators. Any generator that defines genrandbits()
+ can now use randrange() for ranges with a length >= 2**53. Formerly,
+ randrange would return only even numbers for ranges that large (see
+ SF bug #812202). Generators that do not define genrandbits() now
+ issue a warning when randrange() is called with a range that large.
+
- itertools.izip() with no arguments now returns an empty iterator instead
of raising a TypeError exception.