Home/Glossary/Rejection sampling

Glossary · Probability

Rejection sampling

Rejection sampling is a method for drawing from a target distribution by generating candidates from an easier one and discarding any candidate that falls outside the target, redrawing until one is accepted.

Rejection sampling, in full

Category
Probability
Also called
Accept-reject method, Acceptance-rejection sampling
In the glossary
All 75 terms, A–Z

A worked example

The same idea with real numbers attached.

Take max = 6, a d6. 2^32 = 4,294,967,296, and 4,294,967,296 / 6 = 715,827,882.66..., so limit = 715,827,882 x 6 = 4,294,967,292. Values 0 through 4,294,967,291 are kept and exactly four values, 4,294,967,292 to 4,294,967,295, are discarded. The rejection chance per draw is 4 in 4,294,967,296, under one in a billion, and each face ends up backed by exactly 715,827,882 integers.

Sources

Every dated or checkable claim above, with where it came from.

See also

The terms that sit closest to this one.

Where it comes up on this site

Rejection sampling: frequently asked

No. A d4, a d8 and a coin all divide 2^32 exactly, so nothing is ever rejected.

Because 2^32 is not divisible by most face counts, and the leftover tail hands a few outcomes one extra backing value each. On a d6 the skew is about one part in 716 million, which nobody would ever detect, and the redraw removes it for the cost of one comparison. There is no reason to keep a known defect that cheap to fix.

It has no guaranteed stopping point, but the chance of a single rejection on a d6 is roughly 1 in 1.07 billion, so two in a row is not a thing you will see.

More probability terms

The rest of the vocabulary

Lottery mechanics, probability, numerology and astrology, defined in one A–Z.

Open the glossary