This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 7.9 Let us start with an initial seed of 1. The first generator yields the sequence:
1, 6, 10, 8, 9, 2, 12, 7, 3, 5, 4, 11, 1, . . .
The second generator yields the sequence:
1, 7, 10, 5, 9, 11, 12, 6, 3, 8, 4, 2, 1, . . .
Because of the patterns evident in the second half of the latter sequence, most
people would consider it to be less random than the first sequence.
7.10 When m = 2k, the right-hand digits of Xn are much less random than the left-hand
digits. See [KNUT98], page 13 for a discussion.
7.11 Many packages make use of a linear congruential generator with m = 2k. As
discussed in the answer to Problem 10, this leads to results in which the right-hand
digits are much less random than the left-hand digits. Now, if we use a linear
congruential generator of the following form:
Xn+1 = (aXn + c) mod m
then it is easy to see that the scheme will generate all even integers, all odd integers,
or will alternate between even and odd integers, depending on the choice for a and
c. Often, a and c are chosen to create a sequence of alternating even and odd
integers. This has a tremendous impact on the simulation used for calculating π.
The simulation depends on counting the number of pairs of integers whose greatest
common divisor is 1. With truly random integers, one-fourth of the pairs should
consist of two even integers, which of course have a gcd greater than 1. This never
occurs with sequences that alternate between even and odd integers. To get the
correct value of π using Cesaro's method, the number of pairs with a gcd of 1
should be approximately 60.8%. When pairs are used where one number is odd and
the other even, this percentage comes out too high, around 80%, thus leading to the
too small value of π. For a further discussion, see Danilowicz, R. "Demonstrating
the Dangers of Pseudo-Random Numbers," SIGCSE Bulletin, June 1989. -30- ...
View Full Document
This note was uploaded on 02/20/2012 for the course ENC 3250 taught by Professor Dr.timothycerner during the Fall '11 term at UNF.
- Fall '11