
12.5. Use the composition method to generate random numbers distributed according to
f
Y
(y) =
1
4
sin y +
9
32π
3
y
2
, 0 < y ≤ 2π.
Solution: Let us write
f
Y
(y) =
1
4
f
I
(y) +
3
4
f
II
(y) ,
where
f
I
(y) =
1
4
sin
y
2
and f
II
(y) =
3
8π
3
y
2
F
I
(y) = −
1
2
cos
y
2
and F
II
(y) =
1
8π
3
y
3
.
The random numbers y are generated by
y = F
−1
I
(x
2
) = 2 cos
−1
(−2x
2
) , if 0 ≤ x
1
<
1
4
y = F
−1
II
(x
2
) = 2π
3
√
x
2
, if
1
4
≤ x
1
<
3
4
.
where x
1
and x
2
are uniform random numbers between 0 and 1. The Table below illustrates this with
numerical examples.
x
1
0.23 0.89 0.019 0.49 0.76 0.60 0.97 ···
x
2
0.44 0.92 0.20 0.61 0.74 0.94 0.18 ···
y 5.29 6.11 3.96 5.33 5.68 6.16 3.55 ···
317