AM 207
Random Numbers
Spring 2013
Pavlos Protopapas
1
Intorduction
We have introduced the concept of randomly throwing stones or randomly selecting pairs.
In this lecture we will explore how computers generate random numbers.
Randomness means lack of correlation. For a sequence of numbers
r
=
r
1
, r
2
, . . . , r
n
we
can define randomness as an asymptotic property of the series as
N
→ ∞
. Since this is a
hopeless task we can test randomness with a various tests described below.
Long sequences of random numbers are needed in numerous applications, in particular
methods which utilize random numbers such as Monte Carlo simulation techniques, stochas
tic optimization, cryptography calculations that simulate naturally random processes (e.g.
thermal motion or radioactive decay). All these methods require fast and reliable random
number sources.
Many physical processes are random by nature and such processes can be used to produce
random numbers. Examples are noise in semiconductor devices or throwing a dice. On the
other hand computers are deterministic machines and because of that, they can not generate
truly random numbers.
In practice, random numbers are generated by pseudorandom number generators. These
are deterministic algorithms, and consequently the generated numbers are only ”pseudo
random” and have their limitations. But for many applications, pseudorandom numbers can
be successfully used to approximate real random numbers.
Lets say that the probability of a random number to occur is
P
(
r
) and that means the
probability of finding
r
i
in the interval [
r
j
, r
j
+
dr
] is
P
(
r
)
dr
. A uniform distribution means
that P(r) is constant and that means all numbers are equally likely to occur. Not all random
sequences are uniform.
In other distributions (Normal, Poisson etc) not all numbers are
equally likely to occur.
2
Random Number generators
There plenty of random number generators. Most use integer arithmetic and the real numbers
in (0
,
1] are produced by scaling.
2.1
Linear congruential generator
The Linear congruential geneator is based on a integer recursive relation
r
i
+1
= (
a r
i
+
c
) mod
M
where
a, c
and
M
are constants.
This generates a sequence
r
1
, r
2
, . . .
of random integers
which are distributed between [0
, M

1] (if
c >
0) or between [1
, M
] (if
c
= 0). Each
r
i
is
i
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
scaled to the interval (0
,
1) by dividing by
M
. The parameter
M
is usually equal or nearly
equal to the largest integer of the computer. This determines the period
P
of the generator
and
P < M
. The first number in the sequence
r
1
is an input and it is called the
seed
.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '13
 Randomness, Cumulative distribution function, CDF, random numbers, random number, Pavlos Protopapas

Click to edit the document details