## Re: [stella] entropy & randomness

 Subject: Re: [stella] entropy & randomness From: "Thomas Jentzsch" Date: Tue, 9 Oct 2001 09:13:27 +0200
```B. Watson wrote::

> I guess I should go & find some papers on chaos theory or something, but the
> math is beyond me. I never learned much about statistical analysis, but it'd
> be interesting to be able to test `how random' my random numbers are. Any
> pointers?

First, I would would test, how many random bytes (or bits, if you need less than 8) your generator produces. Just count how often you have to call your random function until the start value repeats. Good one byte random generators produce 255 values (1..255).

Then it is getting more complicated, because there should also be a random distance between each value and each distance should have about same possibility.

I'm not an expert to explain this, but there is a nice link
http://www.agner.org/random/theory/
where this is explained mainly understandable to me.

Another idea I've posted here before, is to rely on the randomness (branches, page-faults etc.) of the execution time of your code between timer syncronisation. Then you can i.E. use the following code to produce three random bits.

ldx #\$FF
.waitTim:
lda INTIM-\$FF,x ; 5 waste one cylce here
bpl .waitTim    ; 2/3

Since the timer is counting every cylce after it reached zero and the loop needs eight cycles, this will return \$F8..\$FF, so the last 3 bits are somehow random. Or you could make the loop 16 cyles long and get 4 bits.

Have fun!
Thomas
_______________________________________________________
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |

_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName@xxxxxx, 8MB Speicher, Verschluesselung - http://freemail.web.de

-
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

```