def getRandomNBitInteger(N, randfunc=None):
    """getRandomInteger(N:int, randfunc:callable):long
    Return a random number with exactly N-bits, i.e. a random number
    between 2**(N-1) and (2**N)-1.

    If randfunc is omitted, then Random.new().read is used.

    This function is for internal use only and may be renamed or removed in
    the future.
    """
    value = getRandomInteger (N-1, randfunc)
    value |= 2L ** (N-1)                # Ensure high bit is set
    assert size(value) >= N
    return value
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/pycrypto-2.6.1/lib/Crypto/Util/number.py/getRandomNBitInteger/original