Stratified Disc Rejection Sampling

Random sampling by itself can lead to high variance (manifested in the previous example as clumping). One way to address this is to divide the sample space up into equally-sized regions, and then choose a random sample from within each region. This approach is called stratified sampling.

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