[vcf-midatlantic] Random numbers

Dan Roganti ragooman at gmail.com
Sat Apr 8 12:10:52 EDT 2017

On Sat, Apr 8, 2017 at 11:55 AM, Dan Roganti <ragooman at gmail.com> wrote:

> On Sat, Apr 8, 2017 at 11:45 AM, Dan Roganti <ragooman at gmail.com> wrote:
>> I bet all numbers look even to you when staying up till the break of dawn
>> ;)
>> I tried that line of code and still get a wide assortment of even and odd
>> numbers
>> As the others in this thread explained already, you're not doing anything
>> wrong
>> But one small thing,
>> it's a good practice to out the RND(-1) at the beginning of every program
>> you want random numbers
>> So the RND generator gets seeded again right at the start each time you
>> run that program,
>> so the pseudo-rnd generator still tries to remain at least pseudo vs.
>> being predictable ;)
>> Dan
> ​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
I don't recall at the moment where in the Apple ][ this is located, should
be able to look it up again
And you would PEEK this value into a variable
and then use this value to Seed your RND Generator
100 S=PEEK(address) *  -1
110 RND(S)
The seeding process requires a negative number [S< 0] which is why you
multiply by -1
So then the seeding process is almost random too :)

More information about the vcf-midatlantic mailing list