# Arithmetic Coding

Introduction :: Probability Models :: Applications

## Another application of AC

Mackay suggests another application as a way of generating a sample
from a model, a sophisticated random number generator. As a
simple-minded example, divide the unit interval into lengths
*
p
*
_{
i
}
.
Pick a point at random on the unit interval. The probability that
your pin lies in interval
*
i
*
is
*
p
*
_{
i
}
.
More generally, to generate a sample of bits from some random model,
feed ordinary random bits into an arithmetic decoder for that model.
This corresponds to picking a point at random in [0,1]. The decoder
will select a string at random from the modeled distribution, and
will use the smallest number of random numbers to do the job.