parameters: (self, k)
return_statement: return x >> (bytes * 8 - k)
docstring: getrandbits(k) -> x.  Generates a long int with k random bits.
docstring_summary: getrandbits(k) -> x.  Generates a long int with k random bits.
docstring_tokens: getrandbits ( k ) - > x . Generates a long int with k random bits .
function: def getrandbits(self, k):
          """getrandbits(k) -> x.  Generates a long int with k random bits."""
          if k <= 0:
              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 = long(_hexlify(_urandom(bytes)), 16)
          return x >> (bytes * 8 - k)
function_tokens: def getrandbits ( self , k ) : if k <= 0 : 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 = long ( _hexlify ( _urandom ( bytes ) ) , 16 ) return x >> ( bytes * 8 - k )