03-Sep-2022 20:04:42 RANDLC_TEST(): MATLAB version: Test RANDLC(). RANDLC_TEST01 RANDLC computes pseudorandom values in the interval [0,1]. The initial seed is 123456789 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.610290 RANDLC_TEST02 RANDLC computes 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.610290 Now call 1000 times. Average value = 0.500619 Expecting 0.500000 Variance = 0.085822 Expecting 0.083333 RANDLC_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 10 times, and watch SEED. I Input Output RANDLC SEED SEED 1 1066 1301269531250 0.018492 2 1301269531250 3119242644058 0.044327 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.091514 Reset SEED to its value at step 5, 1664784089866 Now call 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.091514 7 6439705293850 36319925141794 0.516137 8 36319925141794 62762105269962 0.891903 9 62762105269962 9521428314514 0.135308 10 9521428314514 15493591472122 0.220177 What happens with a 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 a negative SEED? I Input Output RANDLC SEED SEED 1 -12345678 11496460823654 0.163375 2 11496460823654 57308483692894 0.814403 3 57308483692894 24416016223670 0.346972 4 24416016223670 23243455921390 0.330309 5 23243455921390 34950297690246 0.496674 6 34950297690246 67306094796798 0.956477 7 67306094796798 14303092062422 0.203259 8 14303092062422 56112719574670 0.797410 9 56112719574670 33131974036134 0.470834 10 33131974036134 46398120772766 0.659357 RANDLC_TEST04 RANDLC_JUMP jumps directly to the K-th value returned by RANDLC. K X(hard way) X(jump) 1 0.63390110 0.63390110 2 0.55715810 0.55715810 4 0.58659610 0.58659610 8 0.70184710 0.70184710 16 0.70266110 0.70266110 32 0.03066810 0.03066810 64 0.03304710 0.03304710 128 0.51364810 0.51364810 256 0.09422610 0.09422610 512 0.01506710 0.01506710 RANDLC_TEST(): Normal end of execution. 03-Sep-2022 20:04:42