2 October 2012 2:33:27.464 PM UNIFORM_PRB FORTRAN77 version Test the UNIFORM library. TEST01 C4_UNIFORM_01 computes pseudorandom complex values uniformly distributed in the unit circle. The initial seed is 123456789 1 0.449860 -0.126667 2 -0.843197 -0.344280 3 0.589627 0.260090 4 0.391140 0.323400 5 -0.139466 -0.156136 6 -0.236066 0.774594E-01 7 0.185991E-01 -0.633214 8 0.892850 0.103136E-01 9 -0.560465 0.763795 10 0.306357 0.262752E-01 TEST02 C4VEC_UNIFORM_01 computes pseudorandom complex values uniformly distributed in the unit circle. The initial seed is 123456789 1 0.449843 -0.126725 2 -0.843222 -0.344217 3 0.589629 0.260085 4 0.391144 0.323394 5 -0.139479 -0.156124 6 -0.236062 0.774735E-01 7 0.185354E-01 -0.633216 8 0.892850 0.103134E-01 9 -0.560429 0.763821 10 0.306357 0.262747E-01 TEST03 C8_UNIFORM_01 computes pseudorandom double precision complex values uniformly distributed in the unit circle. The initial seed is 123456789 1 0.449860 -0.126667 2 -0.843197 -0.344280 3 0.589627 0.260090 4 0.391140 0.323400 5 -0.139466 -0.156136 6 -0.236066 0.774593E-01 7 0.185993E-01 -0.633214 8 0.892850 0.103136E-01 9 -0.560465 0.763795 10 0.306357 0.262752E-01 TEST04 C8VEC_UNIFORM_01 computes pseudorandom double complex values uniformly distributed in the unit circle. The initial seed is 123456789 1 0.449860 -0.126667 2 -0.843197 -0.344280 3 0.589627 0.260090 4 0.391140 0.323400 5 -0.139466 -0.156136 6 -0.236066 0.774593E-01 7 0.185993E-01 -0.633214 8 0.892850 0.103136E-01 9 -0.560465 0.763795 10 0.306357 0.262752E-01 TEST05 CH_UNIFORM computes pseudorandom characters in an interval [CLO,CHI]. The lower endpoint CLO = "A". The upper endpoint CHI = "J". The initial seed is 123456789 1 C 2 J 3 I 4 F 5 E 6 A 7 C 8 B 9 A 10 G TEST06 GET_SEED picks an initial seed value for UNIFORM. The value chosen should vary over time, because the seed is based on reading the clock. This is just the "calendar" clock, which does not change very fast, so calling GET_SEED several times in a row may result in the same value. Initial SEED is 12345678 Next 3 values of R8_UNIFORM: 0.621835 0.177248 0.290613E-02 New seed from GET_SEED is 1053206662 Next 3 values of R8_UNIFORM_01: 0.784243 0.777127 0.178465 New seed from GET_SEED is 1053564934 Next 3 values of R8_UNIFORM_01: 0.588212 0.835609E-01 0.408459 New seed from GET_SEED is 1053923206 Next 3 values of R8_UNIFORM_01: 0.392181 0.389995 0.638452 New seed from GET_SEED is 1054281478 Next 3 values of R8_UNIFORM_01: 0.196150 0.696428 0.868446 TEST065 I4_SEED_ADVANCE advances the seed. Step SEED input SEED output 1 12345 207482415 2 207482415 1790989824 3 1790989824 2035175616 4 2035175616 77048696 5 77048696 24794531 6 24794531 109854999 7 109854999 1644515420 8 1644515420 1256127050 9 1256127050 1963079340 10 1963079340 1683198519 TEST07 I4_UNIFORM_AB computes pseudorandom values in an interval [A,B]. The lower endpoint A = 6 The upper endpoint B = 10 The initial seed is 123456789 I Frequency 6 2002 7 2037 8 1981 9 1962 10 2018 TEST08 I4_UNIFORM_AB computes pseudorandom values in an interval [A,B]. The lower endpoint A = -100 The upper endpoint B = 200 The initial seed is 123456789 1 -35 2 187 3 149 4 69 5 25 6 -81 7 -23 8 -67 9 -87 10 90 11 -82 12 35 13 20 14 127 15 139 16 -100 17 170 18 5 19 -72 20 -96 TEST09 I4_UNIFORM_0I samples a uniform random integer distribution in [0,2**31-1]. Starting with seed = 123456789 First few values: 1 469049721 2 2053676357 3 1781357515 4 1206231778 5 891865166 Number of values computed was N = 1000 Average value was 0.108027E+10 Minimum value was 3947872 Maximum value was 2142991809 Variance was 0.379689E+18 TEST10 I4VEC_UNIFORM computes a vector of pseudorandom values in an interval [A,B]. The lower endpoint A = 6 The upper endpoint B = 10 The initial seed is 123456789 I Frequency 6 2002 7 2037 8 1981 9 1962 10 2018 TEST11 I8_UNIFORM computes pseudorandom values in an interval [A,B]. The lower endpoint A = 1000000000 The upper endpoint B = 8000000000 The initial seed is 123456789987654321 1 1000000000 2 1000000000 3 1000000000 4 1000000000 5 1000000000 6 1000000000 7 1000000000 8 1000000000 9 1000000000 10 1000000000 TEST111 L_UNIFORM computes pseudorandom logical values. The initial seed is 123456789 1 F 2 T 3 T 4 T 5 F 6 F 7 F 8 F 9 F 10 T TEST118 LCRG_ANBN determines a linear congruential random number generator equivalent to N steps of a given one. LCRG parameters: A = 16807 B = 0 C = 2147483647 N A B 0 1 0 1 16807 0 2 282475249 0 3 1622650073 0 4 984943658 0 5 1144108930 0 6 470211272 0 7 101027544 0 8 1457850878 0 9 1458777923 0 10 2007237709 0 TEST119 LCRG_ANBN determines a linear congruential random number generator equivalent to N steps of a given one. LCRG parameters: A = 16807 B = 0 C = 2147483647 N In Out 0 12345 1 12345 207482415 2 207482415 1790989824 3 1790989824 2035175616 4 2035175616 77048696 5 77048696 24794531 6 24794531 109854999 7 109854999 1644515420 8 1644515420 1256127050 9 1256127050 1963079340 10 1963079340 1683198519 11 1683198519 715426902 LCRG parameters: AN = 984943658 BN = 0 C = 2147483647 J N In Out 1 0 12345 2 1 207482415 3 2 1790989824 4 3 2035175616 1 4 12345 77048696 2 5 207482415 24794531 3 6 1790989824 109854999 4 7 2035175616 1644515420 1 8 77048696 1256127050 2 9 24794531 1963079340 3 10 109854999 1683198519 4 11 1644515420 715426902 TEST12 LCRG_SEED directly computes the updated value of a seed used by an linear congruential random number generator. I SEED SEED SEED U Input Output LCRG 1 12345 207482415 207482415 0.966165E-01 2 207482415 1790989824 1790988200 0.833995 3 1790989824 2035175616 2035166288 0.947703 4 2035175616 77048696 77043034 0.358786E-01 5 77048696 24794531 24787953 0.115459E-01 6 24794531 109854999 109852295 0.511552E-01 7 109854999 1644515420 1644514840 0.765787 8 1644515420 1256127050 1256118670 0.584930 9 1256127050 1963079340 1963070954 0.914130 10 1963079340 1683198519 1683186981 0.783800 100 1549894482 99920864 99915736 0.465293E-01 1000 890151694 1408436056 1408433054 0.655854 TEST13 R4_UNIFORM computes pseudorandom values in an interval [A,B]. The lower endpoint A = 5.00000 The upper endpoint B = 10.0000 The initial seed is 123456789 1 6.09209 2 9.78159 3 9.14755 4 7.80848 5 7.07654 6 5.33059 7 6.28789 8 5.54978 9 5.21914 10 8.16983 TEST14 R4_UNIFORM_01 computes pseudorandom values in the interval [0,1]. The initial seed is 123456789 1 0.218418 2 0.956318 3 0.829509 4 0.561695 5 0.415307 6 0.661187E-01 7 0.257578 8 0.109957 9 0.438290E-01 10 0.633966 TEST15 R8_UNIFORM computes pseudorandom values in an interval [A,B]. The lower endpoint A = 5.00000 The upper endpoint B = 10.0000 The initial seed is 123456789 1 6.09209 2 9.78159 3 9.14755 4 7.80848 5 7.07654 6 5.33059 7 6.28789 8 5.54978 9 5.21914 10 8.16983 TEST16 R8_UNIFORM_01 computes pseudorandom values in the interval [0,1]. The initial seed is 123456789 1 0.218418 2 0.956318 3 0.829509 4 0.561695 5 0.415307 6 0.661187E-01 7 0.257578 8 0.109957 9 0.438290E-01 10 0.633966 TEST17 R8_UNIFORM_01 computes a sequence of uniformly distributed pseudorandom numbers. Initial SEED = 12345 First 10 values: I Input Output R8_UNIFORM_01 SEED SEED 1 12345 207482415 0.966165E-01 2 207482415 1790989824 0.833995 3 1790989824 2035175616 0.947702 4 2035175616 77048696 0.358786E-01 5 77048696 24794531 0.115459E-01 6 24794531 109854999 0.511552E-01 7 109854999 1644515420 0.765787 8 1644515420 1256127050 0.584930 9 1256127050 1963079340 0.914130 10 1963079340 1683198519 0.783800 Now compute 1000 elements. Average value = 0.493632 Expecting 0.500000 Variance = 0.081622 Expecting 0.083333 TEST18 R8_UNIFORM_01 computes a sequence of pseudorandom numbers but all computations depend on the seed value. In this test, we show how a sequence of "random" values can be manipulated by accessing the seed. Initial SEED is 1066 Call R8_UNIFORM_01 10 times, and watch SEED. I Input Output R8_UNIFORM_01 SEED SEED 1 1066 17916262 0.834291E-02 2 17916262 470904854 0.219282 3 470904854 1020641983 0.475273 4 1020641983 1977919692 0.921041 5 1977919692 1996891531 0.929875 6 1996891531 881526201 0.410493 7 881526201 321179554 0.149561 8 321179554 1438359167 0.669788 9 1438359167 279105490 0.129969 10 279105490 821685382 0.382627 Reset SEED to its value at step 5, = 1977919692 Now call R8_UNIFORM_01 10 times, and watch how SEED and R8_UNIFORM_01 restart themselves. I Input Output R8_UNIFORM_01 SEED SEED 1 1977919692 1996891531 0.929875 2 1996891531 881526201 0.410493 3 881526201 321179554 0.149561 4 321179554 1438359167 0.669788 5 1438359167 279105490 0.129969 6 279105490 821685382 0.382627 7 821685382 1746365064 0.813215 8 1746365064 1498627099 0.697853 9 1498627099 1737440877 0.809059 10 1737440877 1833671480 0.853870 What happens with a negative SEED? I Input Output R8_UNIFORM_01 SEED SEED 1 -12345678 812103613 0.378165 2 812103613 1766847006 0.822752 3 1766847006 2141242773 0.997094 4 2141242773 336329385 0.156616 5 336329385 511014791 0.237960 6 511014791 838487984 0.390451 7 838487984 679855474 0.316582 8 679855474 1717949478 0.799983 9 1717949478 659242831 0.306984 10 659242831 1026125744 0.477827 TEST19 R8_UNIFORM_01 computes pseudorandom values one at a time. R8MAT_UNIFORM_01 computes a matrix of values. For the same initial seed, the results should be identical, but R8MAT_UNIFORM_01 might be faster. The initial seed is 123456789 I J A(I,J) B(I,J) (R8_UNIFORM_01) (R8MAT_UNIFORM_01) 1 1 0.218418 0.218418 10 1 0.633966 0.633966 20 2 0.949176 0.949176 30 3 0.434341 0.434341 40 4 0.522060 0.522060 50 5 0.718851 0.718851 60 6 0.153587 0.153587 70 7 0.628049 0.628049 80 8 0.635605 0.635605 90 9 0.639914 0.639914 100 10 0.819771 0.819771 TEST20 R8_UNIFORM_01 computes pseudorandom values one at a time. R8VEC_UNIFORM_01 computes a vector of values. For the same initial seed, the results should be identical, but R8VEC_UNIFORM_01 might be faster. The initial seed is 123456789 I A(I) B(I) (R8_UNIFORM_01) (R8VEC_UNIFORM_01) 1 0.218418 0.218418 2 0.956318 0.956318 3 0.829509 0.829509 4 0.561695 0.561695 5 0.415307 0.415307 6 0.661187E-01 0.661187E-01 7 0.257578 0.257578 8 0.109957 0.109957 9 0.438290E-01 0.438290E-01 10 0.633966 0.633966 UNIFORM_PRB Normal end of execution. 2 October 2012 2:33:27.469 PM