def _random_int_of_length(self, length: int) -> int:
        """Generate a random integer of a given length

        If length is 0, so is the number. Otherwise the first digit must not be 0.
        """

        if length < 0:
            raise ValueError("Length must be a non-negative integer.")
        elif length == 0:
            return 0
        else:
            min_value = 10 ** (length - 1)
            max_value = (10**length) - 1
            return self.pyint(min_value=min_value, max_value=max_value)
Generate a random integer of a given length

        If length is 0, so is the number. Otherwise the first digit must not be 0.
        
faker/providers/python/__init__.py