For what it's worth I was investigating/testing PRNGs in Forth. Lee Stewart helped me speed up a test routine

http://atariage.com/...oes-here/page-8

The method I was testing came from GNU Forth. The method is so simple it's hard to believe it works, but when I compared it against the slightly more complicated method from TI-Forth it seems a little better.

It repeats every 64K numbers and gives similar "randomness" The calculations must all be integers. I tried it BASIC and it overflows.

GNU Method

1 SEED=1235

2 PRIME= 28649

3 SEED= INT(SEED*PRIME)+1

4 PRNG=INT(SEED)

SEED @ 6FE5 * 7AB9 + 5 SRC DUP SEED ! ; \ 28 bytes + SRC

I was scratching my head how to test these things I developed 2 tests.

One test is test repeatability in the sequence. It gets a random number and then gets new random #s until the first one shows up again.

The TI Forth method duplicates after 20,000 or so. The GNU Forth method goes for 64K numbers before repeating.

To see how random the numbers are I did this: (pseudo-code)

do
Get a random screen position
Getchar at random position
If char is a space
then put "A" at the position
blank_cntr=blank_cntr-1
else incr. char at the position
duplicates=duplicates+1
iterations=iterations+1
until blank_cntr=0

This test took over 6000 loops to fill the screen!