def _getBitsForLength(length):
    """
    Return the number of bits required to obtain a random digit
    of a given length.
    """
    SLOPE = 0.3010142116935483
    OFFSET = 0.0701126088709696
    return int((length - OFFSET) / SLOPE)
