Tests of generators of (pseudo)random numbers

Clear all symbols from previous evaluations to avoid problems

Clear["Global`*"]

Tests of generators of pseudorandom numbers

Linear congruent generator

Pseudorandom numbers are generated by

(Subscript[x, i+1])=(a (Subscript[x, i])+c) mod m

According to the choice of a, c, m, and (Subscript[x, 0]) we get pseudorandom number generators of different quality

xRandom=1;
myRandom[n_,dim_,par_]:=Module[{out=ConstantArray[0,{n,dim}]},
Do[
Do[
xRandom=Mod[par[[1]] xRandom+par[[2]],par[[3]]];
out[[i,j]]=xRandom,
{j,1,dim}],
{i,1,n}
];
Return[out]
];

Generator RANDU:

p=31;
ListPointPlot3D[myRandom[10000,3,{(2^16)+3,0,(2^p)}]/(2^p),PlotStyle->PointSize[Small],PlotRange->{{0,1},{0,1},{0,1}}]

Generator from Apple CarbonLib:

m=(2^31)-1;
xRandom=1;
N[(((3!m))^(1/3))]
ListPointPlot3D[myRandom[10000,3,{16807,0,m}]/m,PlotStyle->PointSize[Small],PlotRange->{{0,1},{0,1},{0,1}}]

Mathematica's LCG generator:

SeedRandom[1,Method->"Congruential"];
ListPointPlot3D[RandomReal[{0,1},{10000,3}],PlotStyle->PointSize[Small],PlotRange->{{0,1},{0,1},{0,1}}]