[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Random Number Question



Mike Willegal wrote:
Has anyone thought to check to see if there is any issue with the 50KHZ clock on the original keyboards that are used to drive the keyboard scanner "beating" in some fashion with the monitor input polling routine?

Just a thought.

It wouldn't matter, since that could only influence whether a key is
detected on one poll or on the next poll, and the variance in human
"pressing" time is much greater.

In fact, there is always a variance of 1 sample loop time in any polling
situation, so this is not an issue.

The 50kHz encoder clock is only used to debounce keypresses, and
so only contributes a fixed delay to the presentation of a keypress to
the computer.

This would be an issue if keys were able to be pressed at a significant
fraction of 50kHz rate, so that's not a problem.  ;-)


Michael J. Mahon wrote:

vladitx wrote:

On May 7, 12:16 am, pau...@saaf.se (Paul Schlyter) wrote:

The Apple II monitor though has a source for true random numbers, although
with only 16 bits of entropy.  The source is a 16-bit counter which is
incremented each time the monitor input routine polls the keyboard for
a keypress.




The entropy is very low, not 16 bits at all. If I needed random
numbers from Apple II I wouldn't use more than a bit or two per KEYIN.



On the contrary, since the low byte rolls over in less than 5
milliseconds, and since any keypress made by a human has much
more than a 5ms variance, the low bits are essentially random.

If you doubt it, do a test.

And if the input is in response to a prompt that must be read
and responded to, then the variance is more than a second, so
that many bits of the high byte are also random.

-michael

NadaPong: Network game demo for Apple II computers!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it's seriously underused."