full period and spectral test of linear congruential generator and second-order multiple recursive...
TRANSCRIPT
This article was downloaded by: [University of Toronto Libraries]On: 27 October 2014, At: 09:56Publisher: Taylor & FrancisInforma Ltd Registered in England and Wales Registered Number: 1072954 Registered office: MortimerHouse, 37-41 Mortimer Street, London W1T 3JH, UK
Journal of Information and Optimization SciencesPublication details, including instructions for authors and subscription information:http://www.tandfonline.com/loi/tios20
Full period and spectral test of linear congruentialgenerator and second-order multiple recursivegeneratorHui-Chin Tang a & Chi-Chi Chen ba Department of Industrial Engineering and Management , National Kaohsiung Universityof Applied Sciences , Kaohsiung , 80778 , Taiwan, R.O.C.b Department of Industrial Engineering and Management , Cheng Shiu University ,Kaohsiung , 833 , Taiwan, R.O.C.Published online: 18 Jun 2013.
To cite this article: Hui-Chin Tang & Chi-Chi Chen (2009) Full period and spectral test of linear congruential generatorand second-order multiple recursive generator, Journal of Information and Optimization Sciences, 30:4, 769-777, DOI:10.1080/02522667.2009.10699908
To link to this article: http://dx.doi.org/10.1080/02522667.2009.10699908
PLEASE SCROLL DOWN FOR ARTICLE
Taylor & Francis makes every effort to ensure the accuracy of all the information (the “Content”) containedin the publications on our platform. However, Taylor & Francis, our agents, and our licensors make norepresentations or warranties whatsoever as to the accuracy, completeness, or suitability for any purpose ofthe Content. Any opinions and views expressed in this publication are the opinions and views of the authors,and are not the views of or endorsed by Taylor & Francis. The accuracy of the Content should not be reliedupon and should be independently verified with primary sources of information. Taylor and Francis shallnot be liable for any losses, actions, claims, proceedings, demands, costs, expenses, damages, and otherliabilities whatsoever or howsoever caused arising directly or indirectly in connection with, in relation to orarising out of the use of the Content.
This article may be used for research, teaching, and private study purposes. Any substantial or systematicreproduction, redistribution, reselling, loan, sub-licensing, systematic supply, or distribution in anyform to anyone is expressly forbidden. Terms & Conditions of access and use can be found at http://www.tandfonline.com/page/terms-and-conditions
Full period and spectral test of linear congruential generator andsecond-order multiple recursive generator2
Hui-Chin Tang ∗
Department of Industrial Engineering and Management4
National Kaohsiung University of Applied SciencesKaohsiung 807786
Taiwan, R.O.C.
Chi-Chi Chen8
Department of Industrial Engineering and ManagementCheng Shiu University10
Kaohsiung 833Taiwan, R.O.C.12
Abstract
We analyze the periodicity and spectral value of linear congruential generator (LCG) and14
second-order multiple recursive generator (2MRG). Either LCG or 2MRG has an associatedgenerator that possesses the same periods and spectral values. Based on this equivalence16
property, computational effort required for the full period LCG and 2MRG with maximumspectral value criterion is reduced by half.18
Keywords and phrases : Full period, linear congruential generator, multiple recursive generator,
spectral test.20
1. Introduction
The problem of generating an ideal sequence of independent and22
uniform random numbers (RNs) often arises in varied applications, includ-ing operations research, computer science, simulation, and statistics.24
However, the definition of an ideal sequence of independent anduniform RNs is at best of academic interest. In practice, the methods26
of deterministic RN generator are often used. Lehmer [6] was the first
∗E-mail: [email protected]——————————–Journal of Information & Optimization SciencesVol. 30 (2009), No. 4, pp. 769–777c© Taru Publications
Dow
nloa
ded
by [
Uni
vers
ity o
f T
oron
to L
ibra
ries
] at
09:
56 2
7 O
ctob
er 2
014
770 H. C. TANG AND C. C. CHEN
to propose such algorithm called linear congruential generator (LCG).Mathematically, the algorithm of a LCG is based on the formula2
Xn ≡ a1Xn−1(mod m) for n > 1, (1)
where m is the modulus usually chosen to be the largest prime number4
representable as an ordinary integer, multiplier a1 and starting valueX1 are between 1 and (m − 1) . Since then, large varieties of algorithms6
of the deterministic RN generators are proposed in the literature. Thek th-order multiple recursive generator (MRG), generalized feedback shift8
register generator, inverse generator, and combined generator are fourmajor competitors. For a detailed discussion of RN generators, we refer10
the reader to surveys by Fishman [3], and Knuth [4]. This paper deals withthe two special cases of MRGs: first-order and second-order MRGs. The12
first-order MRG is the well-known LCG. A second-order MRG (2MRG) isbased on linear recurrence of the form:14
Xn ≡ a1Xn−1 + a2Xn−2(mod m) for n > 2 , (2)
where m is the modulus, a1 6= 0 , a2 6= 0 , and X1 , X2 are starting values16
which are not all zero.
Long period, randomness and efficiency are three key issues for18
designing an ideal RN generator. The spectral test has become one ofthe statistical powerful and computational efficient tools to evaluate20
the lattice structure. Much literature is aimed at identifying a MRGwith long period and high spectral value [5, 7]. Since the number of22
possible MRGs is extremely huge, the optimal MRG procedures typi-cally rely on enumeration methods such as exhaustive search for the24
LCG [2]. Furthermore, because of this inherent intractability, deducingthe equivalence properties of periodicity and spectral value of LCG and26
2MRG to reduce the search for possible sets of multipliers is the mainpurposes of this paper.28
In the remainder of this paper, a concise review of full period andspectral test is presented in Section 2. The equivalence properties of30
periodicity and spectral value of LCG and 2MRG are shown in sections 3and 4, respectively. Finally, we conclude the findings of this paper.32
Dow
nloa
ded
by [
Uni
vers
ity o
f T
oron
to L
ibra
ries
] at
09:
56 2
7 O
ctob
er 2
014
LINEAR CONGRUENTIAL GENERATOR 771
2. Full period and spectral test
A necessary and sufficient condition of obtaining a full period LCG2
is that multiplier a1 is a primitive root modulo m , defined as am−1
q1 6=
1(mod m) for each prime factor q of (m − 1) . For the popular prime4
modulus m = 231 − 1 , 5.346E8 multipliers are primitive roots modulom . For a 2MRG, Knuth [4] described the following necessary and sufficient6
conditions of obtaining a full period:
(−a2)m−1
q 6= 1(mod m) for each prime factor q of (m− 1);8
xm+1mod f (x) ≡ −a2(mod m); (3)
deg{x(m+1)/q(mod ( f (x) and m))} > 010
for each prime factor q of (m + 1),
where deg(·) is the degree of function and characteristic polynomial12
f (x) = x2 − a1x− a2 . For a 2MRG with modulus m = 231 − 1 , 5.740E17sets of multipliers satisfy full period conditions.14
Another important requirement of an ideal RN generator is therandomness. For any positive integer t , the set of all possible overlapping16
t -tuples of successive RNs produced by a k th-order MRG plus the zero-vector is denoted by TX(k, t) . Let LX(k, t) be the integer lattice generated18
by TX(k, t) and Ztm . The spectral test calculates the maximal distance
dX(k, t) between adjacent parallel hyperplanes. This maximum separation20
between hyperplanes is equivalent to one over the shortest length vX(k, t)of a nonzero vector in a dual lattice. For a LCG, calculating vX(1, t) is to22
solve the following integer quadratic programming problem:
v2X(1, t) = min(u2
1 + u22 + . . . + u2
t )24
s.t. u1 + a1u2 + a21u3 + . . . + at−1
1 ut ≡ 0(mod m) (4)
ui ∈ Fm, i = 1, 2, . . . , t, (u1, u2, . . . , ut) 6= (0, 0, . . . , 0)26
where Fm = {0, 1, . . . , m − 1} is a field of order m . For a 2MRG, let thecompanion matrix of characteristic polynomial f (x) = x2 − a1x − a2 be28
A =
[0 a2
1 a1
]and [A]i j denote its entry in the i th row and j th column.
Dow
nloa
ded
by [
Uni
vers
ity o
f T
oron
to L
ibra
ries
] at
09:
56 2
7 O
ctob
er 2
014
772 H. C. TANG AND C. C. CHEN
The spectral test is aimed at finding vX(2, t) such that
v2X(2, t) = min(u2
1 + u22 + . . . + u2
t )2
s.t. u1 + [A]12u3 + [A2]12u4 + . . . + [At−2]12ut ≡ 0(mod m) (5)
u2 + [A]22u3 + [A2]22u4 + . . . + [At−2]22ut ≡ 0(mod m)4
ui ∈ Fm, i = 1, 2, . . . , t, (u1, u2, . . . , ut) 6= (0, 0, . . . , 0).
In practical, Fincke and Pohst [1] gave a state-of-the-art algorithm to6
calculate dX(k, t) . To rate various dimension t , order k , and set of multi-pliers, dX(k, t) is normalized by the theoretical lower bounds d∗X(k, t) =8
m− kt /γt , where γt is known only for t≤ 8 [4]. The most common aggre-
gation figure of merit is the worst-case performance measure10
SX(k) = mink<t≤8
d∗X(k, t)/dX(k, t) (6)
which takes its value in the interval [0, 1] .12
3. Equivalence properties of LCGs
For a LCG (1), consider an associated LCG14
Zn ≡ a−11 Zn−1(mod m) for n > 1 , (7)
where starting value Z1 is between 1 and (m− 1) . The following theorem16
establishes the relationship between Xn of LCG (1) and Zn of LCG (7).
Theorem 1. Consider two LCGs (1) and (7) with starting values X1 and Z1 ,18
respectively. Then, for n > 1 , we have
XnZn ≡ X1Z1(mod m) (8)20
and
Xm−nZ1 ≡ Xm−1Zn(mod m). (9)22
Proof. For a LCG (1), the root of f (x) = x − a1 = 0 is a1 , it impliesthat Xn ≡ an−1
1 X1(mod m) for n > 1 . A similar argument applied to24
the LCG (7) shows that Zn ≡ a−n+11 Z1(mod m) for n > 1 . Thus, for
n > 1 , we have XnZn ≡ an−11 X1a−n+1
1 Z1 ≡ X1Z1(mod m) and this26
proves identity (8). Another consequence is Xm−nZ1 ≡ am−n−11 X1Z1 ≡
am−21 X1a−n+1
1 Z1 ≡ Xm−1Zn(mod m) for n > 1 , and (9) follows.28
Dow
nloa
ded
by [
Uni
vers
ity o
f T
oron
to L
ibra
ries
] at
09:
56 2
7 O
ctob
er 2
014
LINEAR CONGRUENTIAL GENERATOR 773
If X1Z1 ≡ 1(mod m) , from formula (8), the sequence Xn producedby LCG (1) is an inverse of Zn produced by LCG (7), and vice versa.2
Formula (9) shows that if Z1 ≡ Xm−1(mod m) holds, then the sequenceproduced by LCG (1) is found to be the reversed order of the sequence4
produced by LCG (7), and vice versa. We express the sequence generatedby a LCG (1) as a function of the sequence generated by its associated LCG6
(7), and vice versa. This implies that their periods are equal. We state thisresult formally below.8
Corollary 1. The periods of the LCGs (1) and (7) are equal. Moreover, if one LCGcan achieve the maximum period, so is the other one.10
We now analyze the spectral test of LCGs (1) and (7). The result isstated below.12
Corollary 2. The spectral values of the LCGs (1) and (7) are equal.
Proof. Consider the following integer quadratic programming for the14
spectral value of LCG (7):
v2Z(1, t) = min(u2
1 + u22 + . . . + u2
t ) (10)16
s.t. u1 + a−11 u2 + a−2
1 u3 + . . . + a−t+11 ut ≡ 0(mod m)
ui ∈ Fm, i = 1, 2, . . . , t, (u1, u2, . . . , ut) 6= (0, 0, . . . , 0).18
Multiplying both sides of the constraint with at−11 , we can rewrite prog-
ramming problem (10) in the form20
v2Z(1, t) = min(u2
1 + u22 + . . . + u2
t ) (11)
s.t. at−11 u1 + at−2
1 u2 + at−31 u3 + . . . + ut ≡ 0(mod m)22
ui ∈ Fm, i = 1, 2, . . . , t, (u1, u2, . . . , ut) 6= (0, 0, . . . , 0).
Since each feasible solution (u1, u2, . . . , ut) of integer quadratic prog-24
ramming problem (4) has an associated feasible solution (ut, ut−1, . . . , u1)of programming problem (11), integer quadratic programming problems26
(4) and (11) have the same feasible regions. In addition, their objectivefunctions are same. It follows that two LCGs (1) and (7) have the same28
spectral values.
Dow
nloa
ded
by [
Uni
vers
ity o
f T
oron
to L
ibra
ries
] at
09:
56 2
7 O
ctob
er 2
014
774 H. C. TANG AND C. C. CHEN
4. Equivalence properties of 2MRGs
For every 2MRG (2), we associate another 2MRG2
Zn ≡ −a1a−12 Zn−1 + a−1
2 Zn−2(mod m) for n > 2 , (12)
where starting values Z1 and Z2 are not all zero. To present the equi-4
valence properties of two 2MRGs (2) and (12), we assume that their charac-teristic polynomials f (x) = x2 − a1x − a2 and h(z) = z2 + a1a−1
2 − a−126
are normal polynomials, which mean the irreducible polynomials definingnormal bases. The relationship between 2MRGs (2) and (12) is given in the8
following theorem and will be needed in the remaining section.
Theorem 2. Consider two 2MRGs (2) and (12) with respective starting values10
X j and Z j for j = 1 and 2 . Let f (x) = x2 − a1x − a2 and h(z) = z2+a1a−1
2 z− a−12 be the normal polynomials of (2) and (12), respectively. Also, let12
α j and γ j , j = 1 and 2 , be their respective roots. Then, for j = 1 and 2 , wehave14
α j = −a2γ3− j (13)
and16
α j = 1/γ j. (14)
If 2MRGs (2) and (12) satisfy18
Xn ≡ (−a2)n−1Zn(mod m) for n = 1 and 2 (15)
then20
Xn ≡ (−a2)n−1Zn(mod m) for n > 2. (16)
Proof. For j = 1 and 2, the substitution of −a2γ3− j for x in characteristic22
polynomial f (x) gives f (−a2γ3− j) = (−a2γ3− j)2 − a1(−a2γ3− j)− a2 =a2
2(γ23− j + a1a−1
2 γ3− j − a−12 ) = a2
2h(γ3− j) = 0 . Equation (13) follows from24
f (−a2γ3− j) = f (α j) = 0 for j = 1 and 2. A similar argument shows thatformula (14) holds.26
For the second part of the proof, since f (x) is the normal polynomialof the 2MRG (2), {α1,α2} is a basis of Fm2 over Fm . It follows that each28
Xn can be uniquely represented in the form
Xn ≡2
∑j=1
c jαnj (mod m) for n ≥ 1 , (17)30
Dow
nloa
ded
by [
Uni
vers
ity o
f T
oron
to L
ibra
ries
] at
09:
56 2
7 O
ctob
er 2
014
LINEAR CONGRUENTIAL GENERATOR 775
where c j ∈ Fm for j = 1, 2 . A similar argument shows that
Zn ≡2
∑j=1
d jγnj (mod m) for n ≥ 1 , (18)2
where d j ∈ Fm for j = 1, 2 . Taking into consideration equations (13), (17),and (18), assumption (15) can be rewritten as4
2
∑j=1
c jαnj ≡ (−a2)n−1
2
∑j=1
d jγnj
≡ (−a2)n−12
∑j=1
d j
(α3− j
−a2
)n
6
≡2
∑j=1
d j
−a2αn
3− j
≡2
∑j=1
d3− j
−a2αn
j for n = 1 and 2.8
Then, for j = 1 and 2, we have
c j =d3− j
−a2. (19)10
From (13), (17), (18), and (19), we arrive at
Xn ≡2
∑j=1
c jαnj ≡
2
∑j=1
d3− j
−a2(−a2γ3− j)n
12
≡ (−a2)n−12
∑j=1
d3− jγn3− j
≡ (−a2)n−12
∑j=1
d jγnj14
≡ (−a2)n−1Zn(mod m) for n > 2.
This proves (16). ¤16
With the necessary theorem in hand, we can now describe theequivalence properties precisely.18
Corollary 3. Consider two 2MRGs (2) and (12). If their characteristic poly-nomials f (x) and h(z) are normal polynomials, then the periods and spectral20
values of the 2MRGs (2) and (12) are equal.
Dow
nloa
ded
by [
Uni
vers
ity o
f T
oron
to L
ibra
ries
] at
09:
56 2
7 O
ctob
er 2
014
776 H. C. TANG AND C. C. CHEN
Proof. It is immediately from the identity (16) that the periods of the two2MRGs (2) and (12) are equal.2
We now analyze the spectral values of 2MRGs (2) and (12). Considertwo 2MRGs X1,n ≡ a1X1,n−1 + a2X1,n−2(mod m) for n > 2 with starting4
values X1,1 = 1 and X1,2 = 0 and X2,n ≡ a1X2,n−1 + a2X2,n−2(mod m)for n > 2 with starting values X2,1 = 0 and X2,2 = 1 . Applying above6
two identities, we can rewrite integer quadratic programming problem (5)in the form8
v2X(2, t) = min(u2
1 + u22 + . . . + u2
t )
s.t.t
∑i=1
X1,iui ≡ 0(mod m)10
t
∑i=1
X2,iui ≡ 0(mod m)
ui ∈ Fm, i = 1, 2, . . . , t, (u1, u2, . . . , ut) 6= (0, 0, . . . , 0).12
From (16), it follows that the above programming problem is equivalent tosolve the following one14
v2X(2, t) = min(u2
1 + u22 + . . . + u2
t )
s.t.t
∑i=1
(−a2)i−1Z1,iui ≡ 0(mod m)16
t
∑i=1
(−a2)i−1Z2,iui ≡ 0(mod m)
ui ∈ Fm, i = 1, 2, . . . , t, (u1, u2, . . . , ut) 6= (0, 0, . . . , 0) ,18
where two 2MRGs Z1,n and Z2,n respectively satisfy Z1,n ≡ −a1a−12
× Z1,n−1 + a−12 Z1,n−2(mod m) for n > 2 with starting values Z1,1 = 1 ,20
Z1,2 = 0 and Z2,n = −a1a−12 Z2,n−1 + a−1
2 Z2,n−2(mod m) for n > 2 withstarting values Z2,1 = 0 and Z2,2 = 1 . Since a2 6= 0(mod m) , prog-22
ramming problem (20) is reduced to
min(u21 + u2
2 + . . . + u2t )24
s.t.t
∑i=1
Z1,iui ≡ 0(mod m)
t
∑i=1
Z2, jui ≡ (mod m)26
ui ∈ Fm, i = 1, 2, . . . , t, (u1, u2, . . . , ut) 6= (0, 0, . . . , 0)
Dow
nloa
ded
by [
Uni
vers
ity o
f T
oron
to L
ibra
ries
] at
09:
56 2
7 O
ctob
er 2
014
LINEAR CONGRUENTIAL GENERATOR 777
which is the integer quadratic programming problem of calculating thespectral value of 2MRG (12). So that the spectral values of 2MRGs (2) and2
(12) are equal.
5. Conclusion4
Identifying the sets of multipliers for the full period k th-orderMRGs with the objective of maximizing the spectral value is a subject of6
considerable ongoing research. For large m and k > 1 , the number ofpossible sets of multipliers is usually extremely large, and only a fraction8
of them can be considered. As a result, reducing the number of setsof multipliers is of great interest. This paper theoretically analyzes the10
periodicity and spectral value of LCG and 2MRG. Every LCG (1) and2MRG (2) has an associated LCG (7) and 2MRG (12), respectively. Two12
explicit formulae are shown in equations (8)-(9) and (16). According to thecorollaries 1-3, the periods and spectral values of LCGs (1) and (7), and14
2MRGs (2) and (12) are equal. Therefore, the size of search space for theLCGs and 2MRGs is reduced by half.16
References
[1] U. Fincke and M. Pohst, Improved methods for calculating vectors of18
short length in a lattice, including a complexity analysis, Mathematics ofComputation, Vol. 44 (1985), pp. 463–471.20
[2] G. S. Fishman, Multiplicative congruential random number genera-tors with modulus 2β : an exhaustive analysis for β = 32 and a22
partial analysis for β = 48 , Mathematics of Computation, Vol. 54 (1990),pp. 331–344.24
[3] G. S. Fishman, Monte Carlo: Concepts, Algorithms and Applications, Spri-nger Series in Operations Research, Springer-Verlag, New York, 1996.26
[4] D. E. Knuth, The Art of Computer Programming, Vol 2: Semi-numericalAlgorithms, 3rd edition, Addison-Wesley, Reading MA, 1997.28
[5] C. J. Kung and H. C. Tang, A new heuristic for second-order multi-ple recursive random number generator, Journal of Information &30
Optimization Sciences, Vol. 63 (2005), pp. 63–70.[6] D. H. Lehmer, Proceedings 2nd Symposium on Large-scale Digital Cal-32
culating Machinery, Cambridge, Harvard University Press, pp. 141–146 (1951).34
[7] H. C. Tang, An analysis of linear congruential random number gene-rators when multiplier restrictions exist, European Journal of Opera-36
tional Research, Vol. 182 (2007), pp. 820–828.
Received September, 200838
Dow
nloa
ded
by [
Uni
vers
ity o
f T
oron
to L
ibra
ries
] at
09:
56 2
7 O
ctob
er 2
014