# How to sample uniformly from the surface of a (fish-) bowl?

Define a fish-bowl as a sphere comprised between two horizontal disks. That is, a sphere where we have replaced the top and bottom sectors by horizontal disks. See picture below.

How to sample uniformly from this surface?

My approach is to:

1. Choose either the diskless bowl or one of the disk with probability proportional to its surface.
2. Then, sample uniformly from this surface.
• For the disks, we know how to do it in close form.
• For the sphere with truncated sectors, I do rejection sampling by sampling from the sphere and rejecting until the sampled point is not in one of the removed sectors.

If my computation is correct, a surface area wholly comprised within a disk or within the truncated sphere has same probability. But what about the boundaries? My intuition is that the points neighbors to the circle of contact between a disk and the sphere won't be uniformly distributed. • They will be uniformly distributed with respect to surface area - that's exactly what your algorithm guarantees. So I think you need to examine why your intuition says otherwise near the boundary. Perhaps the distribution won't look uniform there because the curvature changes. You seem to want to connect the points sequentially. If the result is somehow wrong for your application you need to select other than uniformly on area. – Ethan Bolker May 9 '19 at 15:11
• Incidentally, you need not do rejection sampling for the spherical part: Suprisingly the $z$ coordinate for that part turns out to be uniformly distributed across the allowed interval! (And for the other two coordinates sample $\phi$ uniformly from $[0,2\pi)$ and let $x=\sqrt{R^2-z^2}\cos\phi$, $y=\sqrt{R^2-z^2}\sin\phi)$ – Hagen von Eitzen May 9 '19 at 15:20
• The boundaries have two-dimensional measure $0$, so they don't matter. – Robert Israel May 9 '19 at 15:51
• @EthanBolker, well I'd rather trust an experienced mathematician than my intuition. I will accept your answer if you post it. – Julien__ May 9 '19 at 19:32
• @HagenvonEitzen, thanks for the tip, it could be very useful! Are you sure that choosing $\phi$ uniformly in $[0, 2\pi[$ gives uniform distribution on the surface? Because It doesn't work if you take the whole sphere. A good link I used is this one corysimon.github.io/articles/uniformdistn-on-sphere – Julien__ May 9 '19 at 19:33