Details
This is the Middle-Square Method as proposed by John von Neumann in 1949. For our purposes, we are going to use the middle six digits of the seed.
As the results clearly show, this PRNG has an abymsally short period, and thus has little chance of passing any of the tests. Surprisingly enough, it does manage to pass them occasionally, such as its success with the Count the 1s test.
|
Pseudocode
// The current state value
state = 1138;
// random number generator
function RandomNumber() {
// Multiply the state by itself
tmp = state * state;
// Add enough padding to make it at least 8 digits
tmp.pad_left('0', 8);
// Save the middle 6 digits
state = tmp.substr( (tmp.length / 2) - 3 , 6 );
// Return the new value
return state;
}
|
Period Length Test| Seed | Period Length | Result |
|---|
| 1138 | 97 | Failed | | 65535 | 52 | Failed | | 8675309 | 153 | Failed | | 16777216 | 769 | Failed | | 123456789 | 654 | Failed | Minimum to Pass: 64,000
| Plot Test  |
Count the 1s Test| Seed | % Bits that are 1s | Result |
|---|
| 1138 | 0.93% | Failed | | 65535 | 51.48% | Passed | | 8675309 | 51.46% | Passed | | 16777216 | 49.43% | Passed | | 123456789 | 49.41% | Passed | Minimum to Pass: 45%
| Dartboard Test| Seed | Darts Placed | Result |
|---|
| 1138 | 49 | Failed | | 65535 | 26 | Failed | | 8675309 | 77 | Failed | | 16777216 | 662 | Failed | | 123456789 | 613 | Failed | Minimum to Pass: 2,600
|
Crush Test| Seed | Compression Rate | Result |
|---|
| 1138 | 4.20% | Failed | | 65535 | 3.30% | Failed | | 8675309 | 5.92% | Failed | | 16777216 | 36.44% | Failed | | 123456789 | 33.68% | Failed | Minimum to Pass: 95%
| Unique Bytes Test| Seed | Unique High Bytes | Unique Low Bytes | Result |
|---|
| 1138 | 83 | 82 | Failed | | 65535 | 41 | 48 | Failed | | 8675309 | 114 | 116 | Failed | | 16777216 | 163 | 170 | Passed | | 123456789 | 160 | 166 | Passed | Minimum to Pass: 160
|
High/Low Byte Test| Seed | High After High | High After Low | Low After High | Low After Low | Spread | Result |
|---|
| 1138 | 9935 | 20 | 20 | 24 | 14871 | Failed | | 65535 | 1997 | 2336 | 2336 | 3330 | 1661 | Failed | | 8675309 | 1997 | 2335 | 2335 | 3332 | 1665 | Failed | | 16777216 | 2195 | 2596 | 2596 | 2612 | 609 | Failed | | 123456789 | 2177 | 2597 | 2597 | 2628 | 645 | Failed | Maximum to Pass: 500
|
Distribution Test| Seed | 1138 | 65535 | 8675309 | 16777216 | 123456789 |
|---|
| 0.0 to 0.1 | 9914 | 669 | 669 | 928 | 931 |
|---|
| 0.1 to 0.2 | 12 | 1330 | 1329 | 1143 | 1138 |
|---|
| 0.2 to 0.3 | 7 | 1667 | 1660 | 703 | 699 |
|---|
| 0.3 to 0.4 | 10 | 336 | 338 | 785 | 775 |
|---|
| 0.4 to 0.5 | 14 | 332 | 337 | 1234 | 1233 |
|---|
| 0.5 to 0.6 | 9 | 335 | 340 | 1080 | 1082 |
|---|
| 0.6 to 0.7 | 9 | 2001 | 1995 | 1000 | 1002 |
|---|
| 0.7 to 0.8 | 8 | 667 | 668 | 1103 | 1110 |
|---|
| 0.8 to 0.9 | 13 | 2331 | 2318 | 981 | 986 |
|---|
| 0.9 to 1.0 | 5 | 333 | 347 | 1044 | 1045 |
|---|
| Spread | 17827 | 6657 | 6603 | 1207 | 1219 |
|---|
| Result | Failed | Failed | Failed | Failed | Failed |
|---|
Maximum to Pass: 500 |
Sample Output| 609862 | 193165 | 731271 | 475727 | 631617 | 894003 | 924136 | 402734 | 219467 | 816576 | | 679636 | 190509 | 629367 | 610282 | 244411 | 973673 | 803911 | 627289 | 349148 | 190432 | | 626434 | 241955 | 854222 | 969522 | 997290 | 458734 | 43688 | 908641 | 562846 | 679561 | | 180315 | 251349 | 317631 | 88945 | 911213 | 30913 | 955613 | 319620 | 215694 | 652390 | | 561271 | 502513 | 251931 | 346922 | 35487 | 259327 | 725049 | 569605 | 444985 | 801165 | | 186535 | 479530 | 994902 | 982998 | 628506 | 501979 | 198291 | 931932 | 849725 | 203257 | | 131340 | 725019 | 565255 | 951321 | 501164 | 116535 | 358040 | 819264 | 119350 | 424442 | | 15101 | 228040 | 200224 | 8965 | 803712 | 595297 | 437851 | 171349 | 936047 | 618398 | | 241608 | 837442 | 130910 | 713742 | 942764 | 880395 | 509535 | 962591 | 658143 | 315220 | | 936364 | 677754 | 935048 | 431476 | 617153 | 87782 | 705679 | 798285 | 725894 | 692209 |
|