Since I have typed this from scratch too many times, here is the readme from my Chaos Game Test program.

=============/

Description:/

===========/

This program is an application of the Chaos Game. A Chaos Game can be used as a mathematical tool for evaluating how chaotic a stream of data is. In this application of the game, it takes data from a Pseudo Random Number Generator (PRNG).

==============/

How It Works:/

============/

Start with some vertices. For example, the points of a triangle or a square.

Starting from some postion, move halfway to a randomly selected point. Repeat this procedure many times.

If you certain parts of the image are more clear than others, this means that there is bias for certain sequences. For example, if the sequence of vertices jumped to for a triangle is {0,1,2,1,1,1,0,1,0,1,2,2,0,1...} it appears that every 0 is followed by a 1. This will cause a higher density of points lying in the region between vertices 0 and 1.

If certain parts of the image never get filled in (the parts that are supposed to be) then there are certain sequences that are avoided by the sequence.

If very specific clusters of points are formed, it is strong bias toward a very specific, small period sequence. For example, well defined lines traversing the shape indicate specific patterns repeated.

As a note, using a triangle will never get filled in. Instead, it makes a Sierpinski's Triangle. Larger degree polygons should be filled in.

=========================/

How To Use This Program:/

=======================/

Send chaos.8xp to your calculator.

Select Asm( from the Catalog menu ([2nd][0])

Find CHAOS in the [prgm] menu.

Run the program

Press [CLEAR] or [ON] to exit.

This program can only do a triangle and a square because those were the easiest shapes to code. I doubt I will add in the ability for custom shapes, but it is an idea that I have thought of, using list input for vertex coordinates.

To change the PRNG or shape used, open the source and in the first few lines you should see the variables 'rand', 'shape', and 'update' . 'shape' should be 3 or 4. There are 7 built in PRNGs to test:

rand = 0, rand = 1 are simple Linear Feedback Shift Registers (LFSRs) (credit: Iambian, Geekboy)

rand = 2 is an 8-bit Multiple Linear Congruential Generator (MLCG) (I made this)

rand = 3 is a 24-bit MLCG (I made this)

rand = 4 is the ION random routine

rand = 5, rand = 6 are the LCGs used in (3)

You can add your own, too, they just need to be named 'Random' and output in L.

The 'update' variable can be 1 or 256. 256 is advised against as it is slower and less efficient.

update = 256 will update the LCD every 256 pixels plotted. It uses the OS sysroutine and it is slow. I don't even know why I still have it here. It saves 1 byte, but at the cost of hundreds of thousands of t-states (10ths upon 10ths of seconds).

update = 1 will interleave LCD updating for every pixel drawn. This saves many, many t-states (about, 575 per iteration, over thousands of iterations adds up pretty quickly). Also, you get to see the game unfold live, not every 256 frames.

The code is designed for the Brass assembler, but it should be easily ported to use with other assemblers.

========/

Credit:/

======/

There are 3 included PRNGs that I am not the author of:

- The ION routine is easily accessible via the many ION-supporting shells. I only tweaked it to get rid of non-essential bytes (push/pop HL and DE) and to make output in L.

- The two LFSRs are from CaDan, and offered by Geekboy and Iambian. At the time of this writing, it is without a license and free to use, but if they do make a license for it, it will be one of the 'just remember to credit us' ones. That is just proper manners and courtesy. It is a very fast routine and they deserve that credit.

- The rest of the routines (rand = 2,3,5,6) are ones that I made. 2 is crappy, 5 is okay, 6 is good and fast and provides 8-bit results, 3 is excellent and provides up to 24 bits with a very large period. Feel free to use them. Credit would be nice, at least in the source code.

===============/

Final Analysis/

=============/

All of routines pass the 3-vertex test with rand0 and rand1 showing slight bias toward some patterns. This means they are all excellent if you perform mod_3 on the output to select between 3 actions. rand0 and rand1 are the fastest, smallest routines and an excellent choice.

rand0 and rand1 have strong bias for the 4-vertex test. They exhibit the same pattern with a very short periodicity. This means these are bad choices if strongly chaotic data is needed between 4 choices (and other powers of 2, unfortunately).

rand2 is weakly biased in the 4-vertex test. There are much better faster, smaller routines.

rand4 can show strong bias or be excellent. In general, for situations that use peripheral inputs from humans (using a keypad for example) or chaotic device (randomly sending data to the i/o port that grabs the main loop's attention when certain lines are high/low) will produce excellent results. This is due to its use of the R register.

rand5 has some weak bias (much better than rand2, though) for the 4-vertex test.

rand6 is great in the 4-vertex test (it fills in the square), it is fast, and has a period of 65521.

rand3 is excellent in the 4-vertex test, quickly filling in the square. It is the slowest routine, but comparable to the OS Random routine. It takes less than 1600 t-states making it over 100 times faster than the OS routine. It has a period of 4292870399.

All but rand4 (the ION routine) can be seeded. rand3 is probably the best for statistical use, rand6 and rand4 for many games, rand0 and rand1 are best where high speed is necessary, such as with CaDan (a 'bullet hell' game) or fire animation.

Hopefully this answers one of KermM's questions on how good the ionRandom routine is (It is quite good, especially if there is user input.)

**Quote:**

=============/

Description:/

===========/

This program is an application of the Chaos Game. A Chaos Game can be used as a mathematical tool for evaluating how chaotic a stream of data is. In this application of the game, it takes data from a Pseudo Random Number Generator (PRNG).

==============/

How It Works:/

============/

Start with some vertices. For example, the points of a triangle or a square.

Starting from some postion, move halfway to a randomly selected point. Repeat this procedure many times.

If you certain parts of the image are more clear than others, this means that there is bias for certain sequences. For example, if the sequence of vertices jumped to for a triangle is {0,1,2,1,1,1,0,1,0,1,2,2,0,1...} it appears that every 0 is followed by a 1. This will cause a higher density of points lying in the region between vertices 0 and 1.

If certain parts of the image never get filled in (the parts that are supposed to be) then there are certain sequences that are avoided by the sequence.

If very specific clusters of points are formed, it is strong bias toward a very specific, small period sequence. For example, well defined lines traversing the shape indicate specific patterns repeated.

As a note, using a triangle will never get filled in. Instead, it makes a Sierpinski's Triangle. Larger degree polygons should be filled in.

=========================/

How To Use This Program:/

=======================/

Send chaos.8xp to your calculator.

Select Asm( from the Catalog menu ([2nd][0])

Find CHAOS in the [prgm] menu.

Run the program

Press [CLEAR] or [ON] to exit.

This program can only do a triangle and a square because those were the easiest shapes to code. I doubt I will add in the ability for custom shapes, but it is an idea that I have thought of, using list input for vertex coordinates.

To change the PRNG or shape used, open the source and in the first few lines you should see the variables 'rand', 'shape', and 'update' . 'shape' should be 3 or 4. There are 7 built in PRNGs to test:

rand = 0, rand = 1 are simple Linear Feedback Shift Registers (LFSRs) (credit: Iambian, Geekboy)

rand = 2 is an 8-bit Multiple Linear Congruential Generator (MLCG) (I made this)

rand = 3 is a 24-bit MLCG (I made this)

rand = 4 is the ION random routine

rand = 5, rand = 6 are the LCGs used in (3)

You can add your own, too, they just need to be named 'Random' and output in L.

The 'update' variable can be 1 or 256. 256 is advised against as it is slower and less efficient.

update = 256 will update the LCD every 256 pixels plotted. It uses the OS sysroutine and it is slow. I don't even know why I still have it here. It saves 1 byte, but at the cost of hundreds of thousands of t-states (10ths upon 10ths of seconds).

update = 1 will interleave LCD updating for every pixel drawn. This saves many, many t-states (about, 575 per iteration, over thousands of iterations adds up pretty quickly). Also, you get to see the game unfold live, not every 256 frames.

The code is designed for the Brass assembler, but it should be easily ported to use with other assemblers.

========/

Credit:/

======/

There are 3 included PRNGs that I am not the author of:

- The ION routine is easily accessible via the many ION-supporting shells. I only tweaked it to get rid of non-essential bytes (push/pop HL and DE) and to make output in L.

- The two LFSRs are from CaDan, and offered by Geekboy and Iambian. At the time of this writing, it is without a license and free to use, but if they do make a license for it, it will be one of the 'just remember to credit us' ones. That is just proper manners and courtesy. It is a very fast routine and they deserve that credit.

- The rest of the routines (rand = 2,3,5,6) are ones that I made. 2 is crappy, 5 is okay, 6 is good and fast and provides 8-bit results, 3 is excellent and provides up to 24 bits with a very large period. Feel free to use them. Credit would be nice, at least in the source code.

===============/

Final Analysis/

=============/

All of routines pass the 3-vertex test with rand0 and rand1 showing slight bias toward some patterns. This means they are all excellent if you perform mod_3 on the output to select between 3 actions. rand0 and rand1 are the fastest, smallest routines and an excellent choice.

rand0 and rand1 have strong bias for the 4-vertex test. They exhibit the same pattern with a very short periodicity. This means these are bad choices if strongly chaotic data is needed between 4 choices (and other powers of 2, unfortunately).

rand2 is weakly biased in the 4-vertex test. There are much better faster, smaller routines.

rand4 can show strong bias or be excellent. In general, for situations that use peripheral inputs from humans (using a keypad for example) or chaotic device (randomly sending data to the i/o port that grabs the main loop's attention when certain lines are high/low) will produce excellent results. This is due to its use of the R register.

rand5 has some weak bias (much better than rand2, though) for the 4-vertex test.

rand6 is great in the 4-vertex test (it fills in the square), it is fast, and has a period of 65521.

rand3 is excellent in the 4-vertex test, quickly filling in the square. It is the slowest routine, but comparable to the OS Random routine. It takes less than 1600 t-states making it over 100 times faster than the OS routine. It has a period of 4292870399.

All but rand4 (the ION routine) can be seeded. rand3 is probably the best for statistical use, rand6 and rand4 for many games, rand0 and rand1 are best where high speed is necessary, such as with CaDan (a 'bullet hell' game) or fire animation.

Hopefully this answers one of KermM's questions on how good the ionRandom routine is (It is quite good, especially if there is user input.)