The Applesoft random number generator is only a pseudo-random generator (as are most generators); thus, non-random patterns eventually occur. The frequency these patterns repeat varies from program to program, though proper re-seeding of the random number generator helps prevent small repeating sequences.
Here are two suggestions:
1. Use the monitor's random seed at locations 78 and 79 to initialize Applesoft's random number seed. Since the monitor's seed is constantly incrementing while waiting for a key to be pressed, you'll start on one of 65536 different sequences.
10 X = RND (-PEEK (78) - PEEK (79) * 256)
2. This random sequence can be lengthened by re-seeding the generator occasionally within the application program by adding the statement X = RND (-RND (1)).
No method completely eliminates patterns in the random numbers generated, but you can lengthen the sequences until they're difficult to detect.
Applesoft's algorithm is:
1. Multiply the random seed by 11879546.4.
2. Add the result to 3.92767778 E-08.
3. Swap the most and least significant bytes of the result.
4. Force the exponent into the 0..1 range.
The example below shows the effect of the algorithm on a number. The most and least significant two decimal digits are swapped instead of bytes in this example:
0.500000000
* 11879546.4
-----------
5929773.2
+ 0.0000000392767778
-------------------------
5929773.2 (the rest is lost)
-- --- swap "bytes"
3229775.9
0.32297759 force value between 0 and 1