Disc Rejection Sampling

Suppose we want to uniformly sample points on the unit disc. One way to do this is to sample points uniformly on the unit square, and then discard those points that aren't on the disc. This approach is called rejection sampling.

When played, the following things happen every 25ms:
  • A randomly-chosen existing sample is removed; and
  • a new sample is generated; and
  • the sample is colored depending on whether it's in the unit disc or not.