<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _sampleLocationOnDisc(self, top=None):
 """ Helper method to sample from the top and bottom discs of a cylinder. If top is set to True, samples only from top disc. If top is set to False, samples only from bottom disc. If not set (defaults to None), samples from both discs. """

    if top is None:
      z = random.choice([-1, 1]) * self.height / 2.
    else:
      z = self.height / 2. if top else - self.height / 2.
    sampledAngle = 2 * random.random() * pi
    sampledRadius = self.radius * sqrt(random.random())
    x, y = sampledRadius * cos(sampledAngle), sampledRadius * sin(sampledAngle)
    return [x, y, z]