As an intellectual exercise, I'm trying to figure out how to write a reasonably good RNG in TI-BASIC.
A while ago I made a Conway's Game of Life program with a random-ish board generator (which, by the way, turned out to be faster than rand). The basis of the algorithm, where A is the random number:
Code:
Starting with a seed, maybe A=0.1. I don't see any pattern or relationship between successive numbers when graphing results, but the period should be no more than a few thousand.
* Is this method of pseudorandom number generation obviously flawed in another way?
* How can I test the quality of pseudorandom numbers generated (on-calc or otherwise)? Should I just implement some of the tests I've seen online?
* I just thought of using several of these, all seeded differently, and adding them modulo 1:
Code:
Where L1 is seeded to a list of, say, 10 different numbers.
Does this improve the quality? My reasoning is that the different seeds probably have different periods, and therefore the overall period, which is the lcm of all of them, will be at least in the millions.
A while ago I made a Conway's Game of Life program with a random-ish board generator (which, by the way, turned out to be faster than rand). The basis of the algorithm, where A is the random number:
Code:
fPart(10^(A+7->A
Starting with a seed, maybe A=0.1. I don't see any pattern or relationship between successive numbers when graphing results, but the period should be no more than a few thousand.
* Is this method of pseudorandom number generation obviously flawed in another way?
* How can I test the quality of pseudorandom numbers generated (on-calc or otherwise)? Should I just implement some of the tests I've seen online?
* I just thought of using several of these, all seeded differently, and adding them modulo 1:
Code:
fPart(10^(L1+7->L1
fPart(sum(L1->A
Where L1 is seeded to a list of, say, 10 different numbers.
Does this improve the quality? My reasoning is that the different seeds probably have different periods, and therefore the overall period, which is the lcm of all of them, will be at least in the millions.