<commit_before>import numpy as np


def generate_random_bbox(n, img_size, min_length, max_length):
    """Generate valid bounding boxes with random position and shape.

    Args:
        n (int): The number of bounding boxes.
        img_size (tuple): A tuple of length 2. The width and the height
            of the image on which bounding boxes locate.
        min_length (int): The minimum length of edges of bounding boxes.
        max_length (int): The maximum length of edges of bounding boxes.

    Return:
        numpy.ndarray:
        Coordinates of bounding boxes. Its shape is :math:`(R, 4)`. \
        Here, :math:`R` equals :obj:`n`.
        The second axis contains :obj:`x_min, y_min, x_max, y_max`,
        where :obj:`x_min + min_length <= x_max < x_min + max_length` and
        :obj:`y_min + min_length <= y_max < y_min + max_length`.

    """
    W, H = img_size
    x_min = np.random.uniform(0, W - max_length, size=(n,))
    y_min = np.random.uniform(0, H - max_length, size=(n,))
    x_max = x_min + np.random.uniform(min_length, max_length, size=(n,))
    y_max = y_min + np.random.uniform(min_length, max_length, size=(n,))
    bbox = np.stack((x_min, y_min, x_max, y_max), axis=1).astype(np.float32)
    return bbox<commit_msg>fix doc<commit_after>import numpy as np


def generate_random_bbox(n, img_size, min_length, max_length):
    """Generate valid bounding boxes with random position and shape.

    Args:
        n (int): The number of bounding boxes.
        img_size (tuple): A tuple of length 2. The width and the height
            of the image on which bounding boxes locate.
        min_length (float): The minimum length of edges of bounding boxes.
        max_length (float): The maximum length of edges of bounding boxes.

    Return:
        numpy.ndarray:
        Coordinates of bounding boxes. Its shape is :math:`(R, 4)`. \
        Here, :math:`R` equals :obj:`n`.
        The second axis contains :math:`x_{min}, y_{min}, x_{max}, y_{max}`,
        where
        :math:`x_{min} + min\_length \\leq x_{max} < x_{min} + max\_length`
        and
        :math:`y_{min} + min\_length \\leq y_{max} < y_{min} + max\_length`.

    """
    W, H = img_size
    x_min = np.random.uniform(0, W - max_length, size=(n,))
    y_min = np.random.uniform(0, H - max_length, size=(n,))
    x_max = x_min + np.random.uniform(min_length, max_length, size=(n,))
    y_max = y_min + np.random.uniform(min_length, max_length, size=(n,))
    bbox = np.stack((x_min, y_min, x_max, y_max), axis=1).astype(np.float32)
    return bbox
{'fraction_non_alphanumeric': 0.12602739726027398, 'fraction_numerical': 0.005479452054794521, 'mean_word_length': 2.8727272727272726, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7383578', 'n_tokens_mistral': 871, 'n_tokens_neox': 846, 'n_words': 266}