Generation of uniform random numbers using linear congruent generators

Introduction

\(TextForm\`The\ basic\ recursion\ reads\ 
\)\(TextForm\`	r\_\(i + 1\) = \((a*r\_i + c)\) mod\ m
\)A proper choice of the constants a, c, 
    and m is essential for the generation of good ' random' 
        numbers ...

Implementation of the generator

rndm[x_] := Mod[a*x + c,m]

Examples following Kinzel/Reents

bad set

\(x0\  = \ 1234; 

\ a\  = \ 106; 
\ c\  = \ 1283; 
\ m\  = \ 6075; 
    \)

better set

\(x0\  = \ 1234; 

\ a\  = \ 69069; 
\ c\  = \ 1013904243; 

    m\  = \ 2^32; \)

Sample points & plots

\(n = 5000
\)\(uniform\  = \ NestList[rndm, x0, n]/N[m]; 

    triplet\  = \ Partition[uniform, 3]; \)

Show[Graphics3D[{PointSize[0.004],  Map[Point, triplet]}]];

unitvectors  =  Map[(#/Sqrt[# . #])&, triplet];

Show[Graphics3D[{PointSize[0.004], Map[Point, unitvectors]}], 
      ViewPoint  ->  {2, 3, 2}];

Test of the built-in generator

\(\(uni\  = \ Table[Random[], {n}]; 

tri\  = \ Partition[uni, 3]; 


    univec\  = \ Map[\((#/Sqrt[# . #])\)&, tri]; 
\)\)

\(\(\(Show[Graphics3D[{PointSize[0.004], Map[Point, univec]}], 
      ViewPoint -> {2, 3, 2}]; \)
\)\)

Displaying the data generated with 'zufall.c'

a = ReadList["3d_norm.dat",Number,RecordLists->True];

Show[Graphics3D[Point /@ a],ViewPoint->{2.036, 1.127, 2.456}];