I am puzzled by the apparent non-randomness of numbers returned by RND following RANDOMIZE with different seed values. What I cannot seem to find in the documentation is the maximum sensible number for the seed (it just states any number in the helpfile).
I used the following code to test the output from RND using a range of different seed values. The RND function was used to generate the largest possible range of positive integer values. The actual number generated by each line is indicated as a REM statement at the end of each line, following =>
So a few oddities. Firstly, seed values of >30,000,000 often produce "random" numbers that are actually the same. Secondly, numbers produced using seed values between 10,000,000 and 10,000,011 show two consecutive incrementing series, while those between 1,000,000 and 1,000,011 show two interleaved incrementing series. Only the values from 1-11 seem to produce random numbers. The question is what upper limit of the seed value would return a random series of integers from RND?
I know what I am doing looks odd, but basically, I want to convert one number (used as a seed) irreversibly into a defined "seemingly random" second number (the integer value generated by RND), and I'm not sure what a sensible upper limit for the seed value should be.
Peter
I used the following code to test the output from RND using a range of different seed values. The RND function was used to generate the largest possible range of positive integer values. The actual number generated by each line is indicated as a REM statement at the end of each line, following =>
Code:
RANDOMIZE 0: PRINT RND(0, 2147483647) '=> 0 RANDOMIZE 1: PRINT RND(0, 2147483647) '=> 515899392 RANDOMIZE 2: PRINT RND(0, 2147483647) '=> 536870912 RANDOMIZE 3: PRINT RND(0, 2147483647) '=> 547356672 RANDOMIZE 4: PRINT RND(0, 2147483647) '=> 557842432 RANDOMIZE 5: PRINT RND(0, 2147483647) '=> 1636827136 RANDOMIZE 6: PRINT RND(0, 2147483647) '=> 568328192 RANDOMIZE 7: PRINT RND(0, 2147483647) '=> 1647312896 RANDOMIZE 8: PRINT RND(0, 2147483647) '=> 578813952 RANDOMIZE 9: PRINT RND(0, 2147483647) '=> 1118306304 RANDOMIZE 10: PRINT RND(0, 2147483647) '=> 1657798656 RANDOMIZE 11: PRINT RND(0, 2147483647) '=> 49807360 RANDOMIZE 1000000: PRINT RND(0, 2147483647) '=> 954882560 RANDOMIZE 1000001: PRINT RND(0, 2147483647) '=> 2033089064 RANDOMIZE 1000002: PRINT RND(0, 2147483647) '=> 963811920 RANDOMIZE 1000003: PRINT RND(0, 2147483647) '=> 2042018424 RANDOMIZE 1000004: PRINT RND(0, 2147483647) '=> 972741280 RANDOMIZE 1000005: PRINT RND(0, 2147483647) '=> 2050947784 RANDOMIZE 1000006: PRINT RND(0, 2147483647) '=> 981670640 RANDOMIZE 1000007: PRINT RND(0, 2147483647) '=> 2059877144 RANDOMIZE 1000008: PRINT RND(0, 2147483647) '=> 990600000 RANDOMIZE 1000009: PRINT RND(0, 2147483647) '=> 2068806504 RANDOMIZE 1000010: PRINT RND(0, 2147483647) '=> 999529360 RANDOMIZE 1000011: PRINT RND(0, 2147483647) '=> 2077735864 RANDOMIZE 10000000: PRINT RND(0, 2147483647) '=> 1821014080 RANDOMIZE 10000001: PRINT RND(0, 2147483647) '=> 1888401987 RANDOMIZE 10000002: PRINT RND(0, 2147483647) '=> 1955789893 RANDOMIZE 10000003: PRINT RND(0, 2147483647) '=> 2023177800 RANDOMIZE 10000004: PRINT RND(0, 2147483647) '=> 2090565706 RANDOMIZE 10000005: PRINT RND(0, 2147483647) '=> 10469965 RANDOMIZE 10000006: PRINT RND(0, 2147483647) '=> 77857871 RANDOMIZE 10000007: PRINT RND(0, 2147483647) '=> 145245778 RANDOMIZE 10000008: PRINT RND(0, 2147483647) '=> 212633684 RANDOMIZE 10000009: PRINT RND(0, 2147483647) '=> 280021591 RANDOMIZE 10000010: PRINT RND(0, 2147483647) '=> 347409497 RANDOMIZE 10000011: PRINT RND(0, 2147483647) '=> 414797404 RANDOMIZE 30000000: PRINT RND(0, 2147483647) '=> 1190114400 RANDOMIZE 30000001: PRINT RND(0, 2147483647) '=> 1190114400 RANDOMIZE 30000002: PRINT RND(0, 2147483647) '=> 1257502307 RANDOMIZE 30000003: PRINT RND(0, 2147483647) '=> 1324890213 RANDOMIZE 30000004: PRINT RND(0, 2147483647) '=> 1324890213 RANDOMIZE 30000005: PRINT RND(0, 2147483647) '=> 1324890213 RANDOMIZE 30000006: PRINT RND(0, 2147483647) '=> 1392278120 RANDOMIZE 30000007: PRINT RND(0, 2147483647) '=> 1459666026 RANDOMIZE 30000008: PRINT RND(0, 2147483647) '=> 1459666026 RANDOMIZE 30000009: PRINT RND(0, 2147483647) '=> 1459666026 RANDOMIZE 30000010: PRINT RND(0, 2147483647) '=> 1527053933 RANDOMIZE 30000011: PRINT RND(0, 2147483647) '=> 1594441839
I know what I am doing looks odd, but basically, I want to convert one number (used as a seed) irreversibly into a defined "seemingly random" second number (the integer value generated by RND), and I'm not sure what a sensible upper limit for the seed value should be.
Peter
Comment