def generate_random(featureType, numberVertices=<NUM_LIT:3>,<EOL>boundingBox=[-<NUM_LIT>, -<NUM_LIT>, <NUM_LIT>, <NUM_LIT>]):
from geojson import Point, LineString, Polygon<EOL>import random<EOL>import math<EOL>lonMin = boundingBox[<NUM_LIT:0>]<EOL>lonMax = boundingBox[<NUM_LIT:2>]<EOL>def randomLon():<EOL><INDENT>return random.uniform(lonMin, lonMax)<EOL><DEDENT>latMin = boundingBox[<NUM_LIT:1>]<EOL>latMax = boundingBox[<NUM_LIT:3>]<EOL>def randomLat():<EOL><INDENT>return random.uniform(latMin, latMax)<EOL><DEDENT>def createPoint():<EOL><INDENT>return Point((randomLon(), randomLat()))<EOL><DEDENT>def createLine():<EOL><INDENT>return LineString([createPoint() for unused in range(numberVertices)])<EOL><DEDENT>def createPoly():<EOL><INDENT>aveRadius = <NUM_LIT><EOL>ctrX = <NUM_LIT:0.1><EOL>ctrY = <NUM_LIT><EOL>irregularity = clip(<NUM_LIT:0.1>, <NUM_LIT:0>, <NUM_LIT:1>) * <NUM_LIT:2> * math.pi / numberVertices<EOL>spikeyness = clip(<NUM_LIT:0.5>, <NUM_LIT:0>, <NUM_LIT:1>) * aveRadius<EOL>angleSteps = []<EOL>lower = (<NUM_LIT:2> * math.pi / numberVertices) - irregularity<EOL>upper = (<NUM_LIT:2> * math.pi / numberVertices) + irregularity<EOL>sum = <NUM_LIT:0><EOL>for i in range(numberVertices):<EOL><INDENT>tmp = random.uniform(lower, upper)<EOL>angleSteps.append(tmp)<EOL>sum = sum + tmp<EOL><DEDENT>k = sum / (<NUM_LIT:2> * math.pi)<EOL>for i in range(numberVertices):<EOL><INDENT>angleSteps[i] = angleSteps[i] / k<EOL><DEDENT>points = []<EOL>angle = random.uniform(<NUM_LIT:0>, <NUM_LIT:2> * math.pi)<EOL>for i in range(numberVertices):<EOL><INDENT>r_i = clip(random.gauss(aveRadius, spikeyness), <NUM_LIT:0>, <NUM_LIT:2> * aveRadius)<EOL>x = ctrX + r_i * math.cos(angle)<EOL>y = ctrY + r_i * math.sin(angle)<EOL>points.append((int(x), int(y)))<EOL>angle = angle + angleSteps[i]<EOL><DEDENT>firstVal = points[<NUM_LIT:0>]<EOL>points.append(firstVal)<EOL>return Polygon([points])<EOL><DEDENT>def clip(x, min, max):<EOL><INDENT>if(min > max):<EOL><INDENT>return x<EOL><DEDENT>elif(x < min):<EOL><INDENT>return min<EOL><DEDENT>elif(x > max):<EOL><INDENT>return max<EOL><DEDENT>else:<EOL><INDENT>return x<EOL><DEDENT><DEDENT>if featureType == '<STR_LIT>':<EOL><INDENT>return createPoint()<EOL><DEDENT>if featureType == '<STR_LIT>':<EOL><INDENT>return createLine()<EOL><DEDENT>if featureType == '<STR_LIT>':<EOL><INDENT>return createPoly()<EOL><DEDENT>
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.