0% found this document useful (0 votes)
164 views3 pages

Sysmod No.25 Jessica

The first linear congruential generator (LCG) will achieve the maximum cycle length of 32 because its parameters satisfy the conditions for reaching the maximum period (m). The second LCG will not reach the maximum cycle length of 32 because its multiplier (a = 12) is not relatively prime to the modulus (m = 32). Computing the values for the second LCG from a seed of 29 reveals that it enters a loop after the fourth iteration, repeating the same value of 17 indefinitely, rather than cycling through all possible values as the first LCG does.

Uploaded by

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

Sysmod No.25 Jessica

The first linear congruential generator (LCG) will achieve the maximum cycle length of 32 because its parameters satisfy the conditions for reaching the maximum period (m). The second LCG will not reach the maximum cycle length of 32 because its multiplier (a = 12) is not relatively prime to the modulus (m = 32). Computing the values for the second LCG from a seed of 29 reveals that it enters a loop after the fourth iteration, repeating the same value of 17 indefinitely, rather than cycling through all possible values as the first LCG does.

Uploaded by

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

25.

Known :

LCGs = Zi = (9𝑧𝑖−1 + 3) mod (32)

Zi = (12𝑧𝑖−1 + 5) mod (32)

Question :

a. Which LCG will achieve its maximum cycle length ? Answer the question without
computing any Zi values ?
b. Compute Zi through Zi from a seed of 29(Z0 = 29) for secod LCG.

Answer :

a. # For Zi = (𝟗𝒛𝒊−𝟏 + 𝟑) mod (32)


m = 2𝑏 = 25 → because m = 32
(m,c) = 1 → The only positive integer that divides them

∴ Because of the maximum cycle length that LCG will achieve is equal to m, so the maximum
cycle length for this equation = 32.

# For Zi = (𝟏𝟐𝒛𝒊−𝟏 + 𝟓) mod (32)

Formula : 𝑋(𝑛+1) = (𝑎𝑥𝑛 + 𝑐)𝑚𝑜𝑑 𝑚

a = 12 → a -1 = 11 => is not divisable prime factor that divided by 25

∴ Maximum cycle length of this LCG will achieve is not equal to m or maximum cycle length
for this equation is not equal to m.

a. # For Zi = (𝟗𝒛𝒊−𝟏 + 𝟑) mod (32)

i (𝟗𝒛𝒊−𝟏 + 𝟑) mod (32) Zi Ui = Zi/32


1 29 0,906
2 264 8 0,25
3 75 11 0,343
4 102 6 0,187
5 57 25 0,781
6 228 4 0,125
7 39 7 0,218
8 66 2 0,062
9 21 21 0,656
10 192 0 0
11 3 3 0,093
12 30 30 0,937
13 273 17 0,531
14 156 28 0,875
15 255 31 0,968
16 282 26 0,812
17 237 13 0,406
18 120 24 0,75
19 219 27 0,843
20 246 22 0,687
21 201 9 0,281
22 84 20 0,625
23 183 23 0,718
24 210 18 0,562
25 165 5 0,156
26 48 16 0,5
27 147 19 0,593
28 174 14 0,437
29 129 1 0,031
30 11 11 0,343
31 102 6 0,187
32 57 25 0,781

# For Zi = (𝟏𝟐𝒛𝒊−𝟏 + 𝟓) mod (32)

i (𝟏𝟐𝒛𝒊−𝟏 + 𝟓) mod (32) Zi Ui = Zi/32


1 29 0,906
2 353 1 0,031
3 17 17 0,531
4 209 17 0,531
5 209 17 0,531
6 209 17 0,531
7 209 17 0,531
8 209 17 0,531
9 209 17 0,531
10 209 17 0,531
11 209 17 0,531
12 209 17 0,531
13 209 17 0,531
14 209 17 0,531
15 209 17 0,531
16 209 17 0,531
17 209 17 0,531
18 209 17 0,531
19 209 17 0,531
20 209 17 0,531
21 209 17 0,531
22 209 17 0,531
23 209 17 0,531
24 209 17 0,531
25 209 17 0,531
26 209 17 0,531
27 209 17 0,531
28 209 17 0,531
29 209 17 0,531
30 209 17 0,531
31 209 17 0,531
32 209 17 0,531

∴ The result of I = 4 until I = 32 is the same value, so they have the same results on Ui and also
Zi.

You might also like