diff --git a/linesegment.py b/linesegment.py index b7a6538..4c1c8b2 100644 --- a/linesegment.py +++ b/linesegment.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 """The linesegment module defines the class line_segment.""" +import random import point class LineSegment: @@ -34,3 +35,8 @@ class LineSegment: return self.__startpoint.str() + "-->" + self.__endpoint.str() def draw(self): """TODO: Draw the line segment in a canvas.""" + +def get_random(min_x=0, max_x=100, min_y=0, max_y=100): + """Set the point to a random place inside the boundaries""" + return LineSegment(point.Point(random.randint(min_x, max_x), random.randint(min_y, max_y)), \ + point.Point(random.randint(min_x, max_x), random.randint(min_y, max_y)))