next up previous

3.2.1 Sampling via Inversion of the cdf     continued...

Let the r.v. x be uniformly distributed between a and b. In this case,

the cdf is easily found to be

Now sample a random number from , set it equal to , and solve for x:

which yields a sampled point x that is uniformly distributed on the interval .

Consider the penetration of neutrons in a shield, where the pdf for the distance x to collision is described by the exponential distribution,

A distance x to collision is then determined by first sampling a value for the cdf from and solving for x.

One does not need to subtract the random number from unity, because and are both uniformly distributed on [0,1], and statistically the results will be identical.