code: def _sampleLocationOnDisc(self, top=None):
      
      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]
docs: 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.