Digital Signal Processing by John G. Pro Part17
Digital Signal Processing by John G. Pro Part17
Random Number
A
Generators
In some of the examples given in the text, random numbers are generated to simulate
the effect of noise on signals and to illustrate how the method of correlation can be
used to detect the presence of a signal buried in noise. In the case of periodic signals,
the correlation technique also allowed us to estimate the period of the signal.
In practice, random number generators are often used to simulate the effect of
noiselike signals and other random phenomena encountered in the physical world.
Such noise is present in electronic devices and systems and usually limits our ability
to communicate over large distances and to be able to detect relatively weak signals.
By generating such noise on a computer, we are able to study its effects through
simulation of communication systems, radar detection systems, and the like and to
assess the performance of such systems in the presence of noise.
Most computer software libraries include a uniform random number generator.
Such a random number generator generates a number between zero and 1 with equal
probability. We call the output of the random number generator a random variable.
If A denotes such a random variable, its range is the interval 0 ~ A ~ 1.
We know that the numerical output of a digital computer has limited precision,
and as a consequence, it is impossible to represent the continuum of numbers in the
interval 0 ~ A ~ 1. However, we can assume that our computer represents each
output by a large number of bits in either fixed point or floating point. Consequently,
for all practical purposes, the number of outputs in the interval 0 ~ A ~ 1 is suffi-
ciently large, so that we are justified in assuming that any value in the interval is a
possible output from the generator.
The uniform probability density function for the random variable A, denoted as
p(A), is illustrated in Fig. A.l(a). We note that the average value or mean value of
A, denoted as m A, is m A = !. The integral of the probability density function, which
1041
\ /
1042 Appendix A Random Number Generators
p(A)
~----~---L----
o 1
__ A
2
(a)
FtA)
-I"'-------------'-------A
Figure A.l o 1
(b)
represents the area under p(A), is called the probability distribution function of the
random variable A and is defined as
For any random variable, this area must always be unity, which is the maximum value
that can be achieved by a distribution function. Hence
1
r~ I
o 1
2 2
;r
(a)
l F(B) ,
----""I'----+0----..1.
1- - - - - . B
Figure A.2 -2 2
(b)
1043
F(C)
F(C)=A
C=F-'(A)
--=----C'--+o---------i- C
Figure A.3
A uniformly distributed random variable in the range (0, 1) can be used to gen-
erate random variables with other probability distribution functions. For example,
suppose that we wish to generate a random variable C with probability distribution
function F(C), as illustrated in FigA.3. Since the range of F(C) is the interval (0, 1),
we begin by generating a uniformly distributed random variable A in the range (0, 1).
If we set
F(C) = A (A.4)
then
(A.S)
Thus we solve (A.4) for C, and the solution in (A.S) provides the value of C for
which F(C) = A. By this means we obtain a new random variable C with probability
distribution F(C). This inverse mapping from A to C is illustrated in Fig A.3.
EXAMPlEA.l
Generate a random variable C that has the linear probability density function shown in
Fig A.4(a), that is,
P(C)={~' 0~C~2
0, otherwise
p(C) C
"2
---+0----2-'------- C
(a)
F(C)
----l"'''''-----''------C
Figure A.4 2
(b)
I /
1044 Appendix A Random ~umber Generators
FCC) = 1°,
~C2,
1,
which is illustrated in Fig A.4(b). We generate a uniformly distributed random variable A and
set FCC) = A. Hence
FCC) = ~C2 = A
Upon solving for C, we obtain
C=2JA
Thus we generate a random variable C with probability function FCC), as shown in Fig A.4(b).
p(C)
----------------~--------------c
(a)
F(C)
--------~~----~o--------------c
Figure A.S
(b)
1045
F(R) =I - e-R2/2a2 =A
and hence
R = J2a 2 In[1/(1 - A)] (A.ll)
where A is a uniformly distributed random variable in the interval (0. 1). Now if we
generate a second uniformly distributed random variable B and define
e=21l'B (AI2)
then from (A9) and (AlO), we obtain two statistically independent Gaussian dis-
tributed random variables C and D.