[vcf-midatlantic] Random numbers

Bob Applegate bob at corshamtech.com
Sat Apr 8 13:16:14 EDT 2017


> On Apr 8, 2017, at 1:06 PM, Dave McGuire via vcf-midatlantic <vcf-midatlantic at lists.vintagecomputerfederation.org> wrote:
> 
> On 04/08/2017 12:10 PM, Dan Roganti via vcf-midatlantic wrote:
>>> ​Remember,
>>> that step to seed the rnd generator is not perfect either​
>>>>>> ​, eg. RND(-32768) or whichever value​
>>> ​if you use the same seed, guess what,
>>> you get the same random numbers :)
>> 
>> ​This is why you like to use something "random" to seed the rnd generator​
>> Usually every computer has a free running counter,
>> meaning it's constantly being updated in the background
> 
>  If some of my dustiest neurons are working, in the Atari at least there's a scan line counter from the video subsystem available for reading.  At least I think it was something like that.  That was great for seeding random number generators.  The Apple ][ must have something like that.

Or just use a software “timer”, like the delay until the user does something, like move the joystick, press a key, etc.  Ie, sit in a loop waiting for something to happen, incrementing a counter each time through.  When the user finally does something, use the counter as a seed.

Another option is to just sum up all of RAM memory since it’s unlikely exactly the same thing will be in every memory location each run.

Bob




More information about the vcf-midatlantic mailing list