[Python-checkins] r84634 - python/branches/py3k/Lib/random.py
raymond.hettinger
python-checkins at python.org
Wed Sep 8 21:27:59 CEST 2010
Author: raymond.hettinger
Date: Wed Sep 8 21:27:59 2010
New Revision: 84634
Log:
Improve variable name (don't shadow a builtin).
Modified:
python/branches/py3k/Lib/random.py
Modified: python/branches/py3k/Lib/random.py
==============================================================================
--- python/branches/py3k/Lib/random.py (original)
+++ python/branches/py3k/Lib/random.py Wed Sep 8 21:27:59 2010
@@ -634,9 +634,9 @@
raise ValueError('number of bits must be greater than zero')
if k != int(k):
raise TypeError('number of bits should be an integer')
- bytes = (k + 7) // 8 # bits / 8 and rounded up
- x = int.from_bytes(_urandom(bytes), 'big')
- return x >> (bytes * 8 - k) # trim excess bits
+ numbytes = (k + 7) // 8 # bits / 8 and rounded up
+ x = int.from_bytes(_urandom(numbytes), 'big')
+ return x >> (numbytes * 8 - k) # trim excess bits
def seed(self, *args, **kwds):
"Stub method. Not used for a system random number generator."
More information about the Python-checkins
mailing list