06 April 2020 12:30:00 PM RANDLC_TEST C++ version: Test the RANDLC library. TEST01 RANDLC computes pseudorandom values in the interval [0,1]. The initial seed is 1.23457e+08 I RANDLC 1 0.633901 2 0.557158 3 0.503282 4 0.586596 5 0.884073 6 0.165209 7 0.806692 8 0.701847 9 0.516941 10 0.61029 TEST02 RANDLC computes a sequence of uniformly distributed pseudorandom numbers. Initial SEED = 123456789 First 10 values: I Input Output RANDLC SEED SEED 1 123456789 44606850387001 0.633901 2 44606850387001 39206478837805 0.557158 3 39206478837805 35415334725937 0.503282 4 35415334725937 41277992533125 0.586596 5 41277992533125 62211098720361 0.884073 6 62211098720361 11625570795549 0.165209 7 11625570795549 56765914126305 0.806692 8 56765914126305 49388124469493 0.701847 9 49388124469493 36376488146329 0.516941 10 36376488146329 42945314893069 0.61029 Now call RANDLC 1000 times. Average value = 0.499192 Expecting 0.5 Variance = 0.0858645 Expecting 0.0833333 TEST03 RANDLC 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. Set SEED to 1066 Now call RANDLC 10 times, and watch SEED. I Input Output RANDLC SEED SEED 1 1066 1301269531250 0.0184922 2 1301269531250 3119242644058 0.0443271 3 3119242644058 29495326667874 0.419154 4 29495326667874 1664784089866 0.023658 5 1664784089866 30345277309650 0.431232 6 30345277309650 23978980768314 0.340762 7 23978980768314 48407130943938 0.687907 8 48407130943938 37388733848554 0.531326 9 37388733848554 31057455701298 0.441353 10 31057455701298 6439705293850 0.0915137 Reset SEED to its value at step 5, = 1664784089866 Now call RANDLC 10 times, and watch how SEED and RANDLC restart themselves. I Input Output RANDLC SEED SEED 1 1664784089866 30345277309650 0.431232 2 30345277309650 23978980768314 0.340762 3 23978980768314 48407130943938 0.687907 4 48407130943938 37388733848554 0.531326 5 37388733848554 31057455701298 0.441353 6 31057455701298 6439705293850 0.0915137 7 6439705293850 36319925141794 0.516137 8 36319925141794 62762105269962 0.891903 9 62762105269962 9521428314514 0.135308 10 9521428314514 15493591472122 0.220177 What happens with an initial zero SEED? I Input Output RANDLC SEED SEED 1 0 55909509111989 0.794522 2 55909509111989 61155031930969 0.869065 3 61155031930969 45573031421645 0.647632 4 45573031421645 55279057169489 0.785563 5 55279057169489 1250169187877 0.017766 6 1250169187877 27551538756233 0.391531 7 27551538756233 56099529399485 0.797222 8 56099529399485 28525870915841 0.405377 9 28525870915841 35461206354069 0.503934 10 35461206354069 34383163428281 0.488614 What happens with an initial negative SEED? I Input Output RANDLC SEED SEED 1 -123456789 44606850387001 0.633901 2 44606850387001 39206478837805 0.557158 3 39206478837805 35415334725937 0.503282 4 35415334725937 41277992533125 0.586596 5 41277992533125 62211098720361 0.884073 6 62211098720361 11625570795549 0.165209 7 11625570795549 56765914126305 0.806692 8 56765914126305 49388124469493 0.701847 9 49388124469493 36376488146329 0.516941 10 36376488146329 42945314893069 0.61029 RANDLC_TEST04 RANDLC_JUMP jumps directly to the K-th value returned by RANDLC. K X(hard way) X(jump) 1 0.633901 0.633901 2 0.557158 0.557158 4 0.586596 0.586596 8 0.701847 0.701847 16 0.702661 0.702661 32 0.0306676 0.0306676 64 0.0330472 0.0330472 128 0.513648 0.513648 256 0.0942259 0.0942259 512 0.0150668 0.0150668 RANDLC_TEST Normal end of execution. 06 April 2020 12:30:00 PM