code: def _sampleLocationOnEdge(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
      x, y = self.radius * cos(sampledAngle), self.radius * sin(sampledAngle)
      return [x, y, z]
docs: Helper method to sample from the top and bottom edges of a cylinder.
  
      If top is set to True, samples only from top edge. If top is set to False,
      samples only from bottom edge. If not set (defaults to None), samples from
      both edges.