Acceptance/Rejection Sampling
Acceptance/Rejection Sampling
With this Demonstration, you can visualize the rejection sampling technique, which is also known as the acceptance-rejection algorithm. Select a target distribution (the distribution from which you would like to generate random samples) and then choose a "threshold value" that influences the likelihood that a candidate sample from a nontarget distribution will be "accepted" as if it were, in fact, from the target distribution. You can change the number of random variates generated and view histograms of both the accepted and the rejected samples.
c
The exponential distribution and the Cauchy distribution for target distributions are supported on the positive half or whole real line, respectively.