Question: Can Maple generate true-blue random numbers?

I tried to do a Monte Carlo simulation with the Shuffle command from the Statistics package.

Unfortunately the distribution of the random sample differs significantly from the expected distribution even for large n.

Here is what I did:

restart;
with(Statistics):
L:=[Z,Z,E,E,E,E,E,E,E,A,A,A]:
Z:=2:
E:=1:
A:=0:
Y2:=0:
Y3:=0:
Y4:=0:
Y5:=0:
Y6:=0:
Y7:=0:
n:=792000:
Digits:=2:
for i to n do
L:=Shuffle(L):
E1:=add(op(j,L),j=1..5):
X||E1 := X||E1+1:
E2:=add(op(i,L),i=6..10):
Y||E1 := Y||E1 + E2:
S||i:=E1+E2:
end do:
M:=Array(1..6, 1..4):
for i from 2 to 7 do
M[i-1,1]:= "X"||i:
M[i-1,2]:= X||i:
M[i-1,3]:= Y||i:
M[i-1,4]:= convert(Y||i/X||i, float):
end do:
M;

Matrix(6, 4, {(1, 1) = "X2", (1, 2) = 23469, (1, 3) = 150910, (1, 4) = 6.4, (2, 1) = "X3", (2, 2) = 132154, (2, 3) = 754910, (2, 4) = 5.7, (3, 1) = "X4", (3, 2) = 258203, (3, 3) = 1291724, (3, 4) = 5.0, (4, 1) = "X5", (4, 2) = 279695, (4, 3) = 1198581, (4, 4) = 4.3, (5, 1) = "X6", (5, 2) = 147359, (5, 3) = 526180, (5, 4) = 3.6, (6, 1) = "X7", (6, 2) = 39042, (6, 3) = 111566, (6, 4) = 2.9})

Anyway, the expected numbers for the second column are:

Matrix(6, 1, {(1, 1) = 35000, (2, 1) = 133000, (3, 1) = 252000, (4, 1) = 232000, (5, 1) = 119000, (6, 1) = 21000})

Does anyone know, why the Maple results do differ so significantly from the expected results and if it is possible to generate true-blue random numbers in Maple?


 

Please Wait...