def generate_random(featureType, numberVertices=3,
                    boundingBox=[-180.0, -90.0, 180.0, 90.0]):
    """
    Generates random geojson features depending on the parameters
    passed through.
    The bounding box defaults to the world - [-180.0, -90.0, 180.0, 90.0].
    The number of vertices defaults to 3.

    :param featureType: A geometry type
    :type featureType: Point, LineString, Polygon
    :param numberVertices: The number vertices that a linestring or polygon
    will have
    :type numberVertices: int
    :param boundingBox: A bounding box in which features will be restricted to
    :type boundingBox: list
    :return: The resulting random geojson object or geometry collection.
    :rtype: object
    :raises ValueError: if there is no featureType provided.
    """

    from geojson import Point, LineString, Polygon
    import random
    import math

    lon_min, lat_min, lon_max, lat_max = boundingBox

    def random_lon():
        return random.uniform(lon_min, lon_max)

    def random_lat():
        return random.uniform(lat_min, lat_max)

    def create_point():
        return Point((random_lon(), random_lat()))

    def create_line():
        return LineString([create_point() for _ in range(numberVertices)])

    def create_poly():
        ave_radius = 60
        ctr_x = 0.1
        ctr_y = 0.2
        irregularity = clip(0.1, 0, 1) * math.tau / numberVertices
        spikeyness = clip(0.5, 0, 1) * ave_radius

        lower = (math.tau / numberVertices) - irregularity
        upper = (math.tau / numberVertices) + irregularity
        angle_steps = []
        for _ in range(numberVertices):
            angle_steps.append(random.uniform(lower, upper))
        sum_angle = sum(angle_steps)

        k = sum_angle / math.tau
        angle_steps = [x / k for x in angle_steps]

        points = []
        angle = random.uniform(0, math.tau)

        for angle_step in angle_steps:
            r_i = clip(random.gauss(ave_radius, spikeyness), 0, 2 * ave_radius)
            x = ctr_x + r_i * math.cos(angle)
            y = ctr_y + r_i * math.sin(angle)
            x = (x + 180.0) * (abs(lon_min - lon_max) / 360.0) + lon_min
            y = (y + 90.0) * (abs(lat_min - lat_max) / 180.0) + lat_min
            x = clip(x, lon_min, lon_max)
            y = clip(y, lat_min, lat_max)
            points.append((x, y))
            angle += angle_step

        points.append(points[0])  # append first point to the end
        return Polygon([points])

    def clip(x, min_val, max_val):
        if min_val > max_val:
            return x
        else:
            return min(max(min_val, x), max_val)

    if featureType == 'Point':
        return create_point()

    if featureType == 'LineString':
        return create_line()

    if featureType == 'Polygon':
        return create_poly()

    raise ValueError(f"featureType: {featureType} is not supported.")

    Generates random geojson features depending on the parameters
    passed through.
    The bounding box defaults to the world - [-180.0, -90.0, 180.0, 90.0].
    The number of vertices defaults to 3.

    :param featureType: A geometry type
    :type featureType: Point, LineString, Polygon
    :param numberVertices: The number vertices that a linestring or polygon
    will have
    :type numberVertices: int
    :param boundingBox: A bounding box in which features will be restricted to
    :type boundingBox: list
    :return: The resulting random geojson object or geometry collection.
    :rtype: object
    :raises ValueError: if there is no featureType provided.
    
geojson/utils.py