0% found this document useful (0 votes)
48 views

Random-Number Generators: by Tony Warnock

This document discusses different types of random number generators used in simulations and computations, including physical random number generators based on radioactive decay or electrical noise, arithmetical pseudo-random number generators using linear congruential or feedback shift register methods, and quasi-random number generators that produce uniformly distributed numbers like the radical-inverse function. While physical generators can produce truly random numbers, they tend to be slow. Pseudo-random number generators are faster but produce deterministic sequences that only approximate randomness. Quasi-random sequences make no claim of randomness but have desirable statistical properties for applications like Monte Carlo integration.

Uploaded by

Jennifer Gates
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Random-Number Generators: by Tony Warnock

This document discusses different types of random number generators used in simulations and computations, including physical random number generators based on radioactive decay or electrical noise, arithmetical pseudo-random number generators using linear congruential or feedback shift register methods, and quasi-random number generators that produce uniformly distributed numbers like the radical-inverse function. While physical generators can produce truly random numbers, they tend to be slow. Pseudo-random number generators are faster but produce deterministic sequences that only approximate randomness. Quasi-random sequences make no claim of randomness but have desirable statistical properties for applications like Monte Carlo integration.

Uploaded by

Jennifer Gates
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Monte Carlo

very next free flight are accumulated after


each collision. Random-Number
Generators
by Tony Warnock
R
andom numbers have applications in many areas: simulation, game-playing,
cryptography, statistical sampling, evaluation of multiple integrals, particle-
transport calculations, and computations in statistical physics, to name a few.
Since each application involves slightly different criteria for judging the worthiness
of the random numbers generated, a variety of generators have been developed, each
with its own set of advantages and disadvantages.
Depending on the application, three types of number sequences might prove
adequate as the random numbers. From a purist point of view, of course, a series of
numbers generated by a truly random process is most desirable. This type of sequence
is called a random-number sequence, and one of the key problems is deciding whether
or not the generating process is, in fact, random. A more practical sequence is the
pseudo-random sequence, a series of numbers generated by a deterministic process
that is intended merely to imitate a random sequence but which, of course, does not
rigorously obey such things as the laws of large numbers (see page 69). Finally, a
quasi-random sequence is a series of numbers that makes no pretense at being random
but that has important predefine statistical properties shared with random sequences.
Physical Random-Number Generators
Games of chance are the classic examples of random processes, and the first
inclination would be to use traditional gambling devices as random-number generators.
Unfortunately, these devices are rather slow, especially since the typical computer
application may require millions of numbers per second. Also, the numbers obtained
from such devices are not always truly random: cards may be imperfectly shuffled,
dice may not be true, wheels may not be balanced, and so forth. However, in the early
1950s the Rand Corporation constructed a million-digit table of random numbers using
an electrical roulette wheel. (The device had 32 slots, of which 12 were ignored; the
others were numbered from O to 9 twice.)
Classical gambling devices appear random only because of our ignorance of initial
conditions; in principle, these devices follow deterministic Newtonian physics. Another
possibility for generating truly random numbers is to take advantage of the Heisenberg
uncertainty principle and quantum effects, say by counting decays of a radioactive
source or by tapping into electrical noise. Both of these methods have been used to
generate random numbers for computers, but both suffer the defects of slowness and
ill-defined distributions (however, on a different but better order of magnitude than
gambling devices).
I 37
Monte Carlo
For instance, although each decay in a radioactive source may occur randomly
and independently of other decays, it is not necessarily true that successive counts in
the detector are independent of each other. The time it takes to reset the counter,
for example, might depend on the previous count. Furthermore, the source itself
constantly changes in time as the number of remaining radioactive particles decreases
exponentially. Also, voltage drifts can introduce bias into the noise of electrical devices.
There are, of course, various tricks to overcome some of these disadvantages. One
can partially compensate for the counter-reset problem by replacing the string of bits
that represents a given count with a new number in which all of the original 1-1 and O-O
pairs have been discarded and all of the original O-1 and 1-0 pairs have been changed
to O and 1, respectively. This trick reduces the bias caused when the probability of a
O is different from that of a 1 but does not completely eliminate nonindependence of
successive counts.
A shortcoming of any physical generator is the lack of reproducibility. Repro-
ducibility is needed for debugging codes that use the random numbers and for making
correlated or anti-correlated computations. Of course, if one wants random numbers
for a cryptographic one-time pad, reproducibility is the last attribute desired, and time
can be traded for security. A radioactive source used with the bias-removal technique
described above is probably sufficient.
Arithmetical Pseudo-Random Generators
The most common method of generating pseudo-random numbers on the computer
uses a recursive technique called the linear-congruential, or Lehmer, generator. The
sequence is defined on the set of integers by the recursion formula
or, in binary,
(1)
138
Monte Carlo
to form the normal number
1101110010111011110001001 101010111100110111101111 . . . .
If the number is blocked into 5-digit sets
11011,10010, 11101, 11100,01001, 10101,01111,00110,11 110, 11111,..., (2)
it becomes a sequence of numbers in base 2 that satisfy all linear statistical conditions
for randomness. For example, the frequency of a specific 5-bit number is (1/2)
5
.
Sequences of this type do not appear random when examined; it is easy for a
person to guess the rule of formation. However, we can further disguise the sequence
by combining it with the linear-congruence sequence generated earlier (Seq. 1). We do
this by performing an exclusive-or (XOR) operation on the two sequences:
Los Alamos Science Special Issue 1987 1 3 9
Monte Carlo
and
11011, 10010,11101,11100,01001, 10101,01111,00110, 11110,111 11,... (2)
yield
Of course, if Seq. 3 is carried out to many places, a pattern in it will also become
apparent. To eliminate the new pattern, the sequence can be XORed with a third
pseudo-random sequence of another type, and so on.
This type of hybrid sequence is easy to generate on a binary computer. Although
for most computations one does not have to go to such pains, the technique is especially
attractive for constructing canonical generators of apparently random numbers.
A key idea here is to take the notion of randomness to mean simply that the
sequence can pass a given set of statistical tests. In a sequence based on normal
numbers, each term will depend nonlinearly on the previous terms. As a result, there
are nonlinear statistical tests that can show the sequence not to be random. In particular,
a test based on the transformations used to construct the sequence itself will fail. But,
the sequence will pass all linear statistical tests, and, on that level, it can be considered
to be random.
What types of linear statistical tests are applied to pseudo-random numbers?
Traditionally, sequences are tested for uniformity of distribution of single elements,
pairs, triples, and so forth. Other tests may be performed depending on the type of
problem for which the sequence will be used. For example, just as the correlation
between two sequences can be tested, the auto-correlation of a single sequence can be
tested after displacing the original sequence by various amounts. Or the number of
different types of runs can be checked against the known statistics for runs. An
increasing run, for example, consists of a sequential string of increasing numbers
from the generator (such as, 0.08, 0.21, 0.55, 0.58, 0.73, . . .). The waiting times
for various events (such as the generation of a number in each of the five intervals
(o, 0,2), (0.2, 0,4), ..., (0.8, 1)) may be tallied and, again, checked against the known
statistics for random-number sequences.
If a generator of pseudo-random numbers passes these tests, it is deemed to be a
good generator, otherwise it is bad. Calling these criteria tests of randomness is
misleading because one is testing a hypothesis known to be false. The usefulness of
the tests lies in their similarity to the problems that need to be solved using the stream
of pseudo-random numbers. If the generator fails one of the simple tests, it will surely
not perform reliably for the real problem. (Passing all such tests may not, however, be
enough to make a generator work for a given problem, but it makes the programmers
setting up the generator feel better.)
140 pec i al I ssue 1 9 8 7
Monte Carlo
the basis of the Metropolis
technique of evaluating integrals by the Monte Carlo method,
Now if the points are taken from a random or a psuedo-random sequence, the
statistical uncertainty will be proportional to 1/@. However, if a quasi-random se-
quence is used, the points will occupy the coordinate space with the correct distribution
but in a more uniform manner, and the statistical uncertainty will be proportional to
l/N. In other words, the uncertainty will decrease much faster with a quasi-random
sequence than with a random or pseudo-random sequence.
How are quasi-random sequences generated? One type of sequence with a very
uniform distribution is based on the radical-inverse function. The radical-inverse
uniform distribution and is useful in mutiple integration or multi-dimensional sampling.
There are many other types of random, pseudo-random, or quasi-random sequences
than the ones I have discussed here, and there is much research aimed at generating
sequences with the properties appropriate to the desired application. However, the
examples I have discussed should illustrate both the approaches being taken and the
obstacles that must be overcome in the quest of suitable random numbers. I
141

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy