This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ble geometrical patterns
in the distribution of outgoing directions. Remarks 9 Long Period - The generator should be of long period (ideally, the generator should not repeat practically, the repetition should occur only after the generation of a very large
set of random numbers). More explanation is provided below. Uniformity - The sequence of random numbers should be uniform, and unbiased. That is, equal fractions of random numbers should fall into equal \areas" in space. For
example, if random numbers on 0,1) are to be generated, it would be poor practice
were more than half to fall into 0, 0.1), presuming the sample size is su ciently large.
Often, when there is a lack of uniformity, there are n-tuples of random numbers which
are correlated. In this case, the space might be lled in a de nite, easily observable
pattern. Thus, the properties of uniformity and uncorrelated sequences are loosely
related. E ciency - The generator should be e cient. In particular, the generator used on vector machines should be vectorizable, with low overhead. On massively parallel architectures, the processors should not have to communicate among themselves, except
perhaps during initialization. This is not generally a signi cant issue. With minimal
e ort, random number generators can be implemented in a high level language such as
C or FORTRAN, and be observed to consume well less than 1% of overall CPU time
over a large suite of applications. Exercise 2 - To illustrate the mean and variance of uniformly
distributed random numbers
For uniformly distributed real random numbers, Rn, on 0,1), the average value should be
0.5. Note that, to compute the mean and variance, we can order the random numbers in
any fashion (as both of these computations are independent of order). It is useful to choose
to order the real, random numbers in ascending order, and approximate the distribution in
the form of a continuous variable R. Verify by direct integration that the average, R, and
the variance, 2, should be 0.5 and 0.083333, respectively, as follows:
R = RdR = 2
= (R ; 0:5)2dR = 12
0 2.2 The Random Number Cycle Pursuant to the above discussion, it is useful to present pseudorandom sequences in the
context of their cyclical structure. Almost all random number generators have as their basis
a sequence of pseudorandom integers (there are exceptions). The integers or \ xed point"
numbers are manipulated arithmetically to yield oating point or \real" numbers. The 10
Finish ● Clockwise ● ● ● Traversal
● ● ● ● ● ● ●
● Figure 2: Illustration of Random Number Cycle
random number cycle can be presented in terms of either integers or real numbers. Here, for
clarity, we con ne ourselves to integers.
In Figure 2, we illustrate a random number cycle representing a sequence of 12 integers.
Each black dot represents a distinct integer. Our convention will be to start at the top of the
cycle (i.e. 12 o'clock), traverse the cycle clockwise, and nish at the integer just to the left
of the start. The nature of the cycle illustrates that: (1) the sequence has a nite number of
integers, (2) the sequence gets traversed in a particular order, and (3) the sequence repeats
if the period of the generator is exceeded (i.e., the cycle can be traversed more than once).
Furthermore, the integers need not be distinct that is, they may repeat. We shall address
this point subsequently. These all are properties of pseudorandom sequences of integers. In
subsequent sections, we shall illustrate these aspects with speci c examples. 3 Linear, Congruential Generators
3.1 Approach We begin by discussing the linear congruential generator - the one most commonly used for
generating random integers.
Xn+1 = aXn + c (mod m)
Here, we generate the next random integer Xn+1 using the previous random integer Xn ,
the integer constants a and c, and the integer modulus m. After the integer aXn + c is
generated, modulo arithmetic using the modulus m is performed, to yield the new "random"
integer Xn+1 . Remarks 11 To get started, the algorithm requires an initial \seed," X0, which must be provided
by some means (we shall discuss this later). The entire sequence is characterized by the
multiplier, a the additive constant, c the modulus, m and the initial seed X0. Following
Anderson Anderson, 1990], we therefore refer to the sequence generated as LCG(a c m X0),
which completely determines the sequence. Here, LCG denotes a Linear, Congruential Generator.
The appearance of randomness is provided by performing modulo arithmetic or remaindering. For example, the nonnegative integers 0 1 2 3 4 5 : : : modulo 3 are 0 1 2 0 1 2 : : :.
Note that the next result, Xn+1 , depends upon only the previous integer, Xn. This is a characteristic of linear, congruential generators which minimizes storage requirements, but at the
same time, imposes restrictions on the period.
With Xn determined, we generate a corresponding real number as follo...
View Full Document
This document was uploaded on 01/28/2014.
- Fall '14