diff options
author | Yesudeep Mangalapilly <yesudeep@gmail.com> | 2011-08-24 16:53:39 +0530 |
---|---|---|
committer | Yesudeep Mangalapilly <yesudeep@gmail.com> | 2011-08-24 16:53:39 +0530 |
commit | b5bab2221ad88ad49962c402eecae418db6a9eba (patch) | |
tree | 0d752cc34ec7b64a4b1f70caabee05b733157cf6 /rsa/randnum.py | |
parent | 245952eba1d073e7b92e7b384829cbb0386a8134 (diff) | |
download | rsa-git-b5bab2221ad88ad49962c402eecae418db6a9eba.tar.gz |
Reverts docstring quoting syntax.
Diffstat (limited to 'rsa/randnum.py')
-rw-r--r-- | rsa/randnum.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/rsa/randnum.py b/rsa/randnum.py index f6494d8..0e78274 100644 --- a/rsa/randnum.py +++ b/rsa/randnum.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Functions for generating random numbers.""" +'''Functions for generating random numbers.''' # Source inspired by code by Yesudeep Mangalapilly <yesudeep@gmail.com> @@ -24,11 +24,11 @@ from rsa import common, transform from rsa._compat import byte def read_random_bits(nbits): - """Reads 'nbits' random bits. + '''Reads 'nbits' random bits. If nbits isn't a whole number of bytes, an extra byte will be appended with only the lower bits set. - """ + ''' nbytes, rbits = divmod(nbits, 8) @@ -45,8 +45,8 @@ def read_random_bits(nbits): def read_random_int(nbits): - """Reads a random integer of approximately nbits bits. - """ + '''Reads a random integer of approximately nbits bits. + ''' randomdata = read_random_bits(nbits) value = transform.bytes2int(randomdata) @@ -58,12 +58,12 @@ def read_random_int(nbits): return value def randint(maxvalue): - """Returns a random integer x with 1 <= x <= maxvalue + '''Returns a random integer x with 1 <= x <= maxvalue May take a very long time in specific situations. If maxvalue needs N bits to store, the closer maxvalue is to (2 ** N) - 1, the faster this function is. - """ + ''' bit_size = common.bit_size(maxvalue) |