Altered the way that the {random} value (from 0..3) is chosen.
authorRichard Rauch <rkr@olib.org>
Sat, 8 Nov 2003 01:56:45 +0000 (01:56 +0000)
committerRichard Rauch <rkr@olib.org>
Sat, 8 Nov 2003 01:56:45 +0000 (01:56 +0000)
commit0c915a83c6995a6fd68d509f35de2403f44a70a0
tree4b0aca950a011f9eed07dd0627e860a37c3a751a
parentda4960b49d65e109134002518c3396c1fb45226b
Altered the way that the {random} value (from 0..3) is chosen.

Previously, it picked out two adjacent bits in the result of rand().
Unfortunately, these adjacent bits (at least on NetBSD) have a certain
amount of dependance.  After a period (perhaps a thousand or so?), it
starts to repeat the pattern of those two bits.  (I think; I haven't
actually tested that directly.)  This presumably is locking it into a
an an N-way attractor on the "snowflake", such that if you zoom in a
ways, you will start to see some spots *quickly* are colored, and
others are *never* colored.

What I've done now is to pick up two widely-spaced bits in a single
rand() call.  (Perhaps we would do as well to pick up something like
bit #16 from two consecutive rand() calls?)  These widely-spaced bits
have a lower statistical dependance on one another (if I can get away
with using that term for an arithmetic operation; though since stats
has more to do with sampling and less to do with true randomness, I
may be safe).

The net effect, at leats on NetBSD, is far better snowflake if you zoom
in on it.

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@324 7f0cb862-5218-0410-a997-914c9d46530a
progs/demos/Fractals_random/fractals_random.c