gen3d. Generates pseudo-random files using a 3-dimensional cellular automaton.

Parameters:

gen3d [nbytes  8404992] [seed n] [xsize 8] [ysize 8] [zsize 8] [file out.rnd]
      [silent] [rule1, rule2 ...]

Example :

./gen3d seed 31415 xsize 9 ysize 9 zsize 9 file myfile.rnd \
        63789bd66560e90d129fac5ba7529c4a c72ae3fc3f08d8959439f0944d938b72 \
        f2b9e52dbc43e80547549ce98f0323e9

Default rule: 63789bd66560e90d129fac5ba7529c4a

Well, I'll give you an example of how to run the software.

$ ./gen3d seed 2002 xsize 9 ysize 9 zsize 9 file myfile.rnd \
        63789bd66560e90d129fac5ba7529c4a \
	c72ae3fc3f08d8959439f0944d938b72 \
        f2b9e52dbc43e80547549ce98f0323e9

This builds the file myfile.rnd that will have 8MB by default. The 3-dimensional
CA will have 9x9x9 cells. The seed of the auxiliary RNG that will fill the
CA the first time and then we have 3 128-bit rules obtained with the GA.
Then we use two well know battery of tests, ENT and diehard (I used diehardc).
You can find both with a google search.

[n@localhost gen3d]$ ent myfile.rnd
Entropy = 7.999960 bits per byte.

Optimum compression would reduce the size
of this 8405004 byte file by 0 percent.

Chi square distribution for 8405004 samples is 470.54, and randomly
would exceed this value 0.01 percent of the times.

Arithmetic mean value of data bytes is 127.6308 (127.5 = random).
Monte Carlo value for Pi is 3.138139137 (error 0.11 percent).
Serial correlation coefficient is 0.000940 (totally uncorrelated = 0.0).

The Chi square for this test pointed out that this sequence seems
to be non-random. Now let's see what diehardc has to say.

[n@localhost gen3d]$ diehardc myfile.rnd result.txt 1111111111111111

This generates a big file (results.txt ) with the results of the battery of
tests. During the past year I was afraid I would have to use a spreadsheet to
analyze the data of the 100 runs! Fortunately I learned Perl and I wrote
a few scripts that saved me many hours! One of them parses the output of
the diehardc program and prints a summary of the results.

[n@localhost gen3d]$ cat myfile.txt  | ./parse_diehardc.pl
OVERLAPPING SUMS : 0.826668 : P
RUNS UP 1 : 0.580421 : P
RUNS DOWN 1 : 0.666931 : P
RUNS UP 2 : 0.404106 : P
RUNS DOWN 2 : 0.581731 : P
3DSPHERES : 0.497975 : P
PARKING LOT : 0.296800 : P
BIRTHDAY SPACINGS TEST : 0.048803 : P
BINARY RANK 6x8 MATRICES : 0.447643 : P
BINARY RANK 31x31 MATRICES : 0.428039 : P
BINARY RANK 32x32 MATRICES : 0.438105 : P
COUNT-THE-1's IN SUCCESSIVE BYTES 1 : 0.598409 : P
COUNT-THE-1's IN SUCCESSIVE BYTES 2 : 0.691352 : P
CRAPS No. OF WINS : 0.068278 : P
CRAPS THROWS/GAME : 0.702818 : P
MINIMUM DISTANCE : 0.772951 : P
OVERLAPPING PERMUTATION 1 : 0.560856 : P
OVERLAPPING PERMUTATION 2 : 0.030297 : P
SQUEEZE : 0.174084 : P
Passed : 19/19 :
BITSTREAM : 20/20 :
OPSO : 22/23 :
OQSO : 28/28 :
DNA : 31/31 :

Score=22.957
KS=0.799307

In this particular case, the results were quite good but it's not always the
case. I finally learned the lesson: non-uniform cellular automata are better
for random number generation. The report is a 60 pages document written in
Spanish, it's available upon request. I really would like to continue this
research.

I would like to thank Moshe Sipper and Marco Tomassini. They have published
very good papers on random number generation with cellular automata on the
Internet. I would also like to thank everyone at the Universidad del Magdalena:
Eduardo Daza, Idanis Diaz and Rosario Madera for the useful discussions,
Samuel Prieto for being the director of this work, Jaime Abella
and Jhonny Gmez who stood awake with me helping me out with the nightly
runs of the GA.

I haven't released the GA because I don't like the code that much. I used
a tweaked example of the GALib toolkit for the parallel GA. I'd like to
program my own GA since I am using a very simple GA... I can send it thru
e-mail, too.

Nelson Castillo
arhuaco (is my account at) yahoo.com
