[Coco] Tandy Color Computer 3 RND Function
Melanie and John Mark Mobley
johnmarkmelanie at gmail.com
Thu Mar 26 22:29:13 EDT 2020
Jim Okeefe,
I think you can pick up atmospheric noise on an AM or shortwave radio. Select a spot between stations and listen to the noise. Take analog-to-digital samples of the noise and take the least significant bit of the samples and build a number out of the least significant bits. Then take that number and seed your pseudo random number generator. Then reseed your pseudo random number generator every 10 minutes or so.
On the Tandy Color Computer you can plug an AM radio (tuned to noise) in to the cassette port, and sample the data off of the cassette port. This is a 1-bit signal. So shift one bit at time into an accumulator until you have a 16 bit number, store this number in a float called NUMBER, and then call R=RND(-NUMBER). This will seed the pseudo random number generator. Or you can use the 16-bit number directly.
If you have joysticks on the joystick ports then there position is somewhat random. The last character read from the serial port is somewhat random. If you go out on internet and capture the temperature of 10 cities and use this data as a random number. How long it takes to ping Google is somewhat random. The time between two key presses is random. The value of the stack pointer at the next timer interrupt is somewhat random. If you have the user type in the number of players and then call R=RND(-TIMER) then that is random.
You can point a camera at a lava lamp or an fish aquarium. And capture the least significant bits off of all the pixels and use those as random numbers.
You can use a radiation detector as a random source of data.
-John Mark Mobley
More information about the Coco
mailing list