Hi there, this is my first post in this forum. I hope you can help me with my problem :)

I've created a little program to solve a problem for my class. This is the first time, I wrote a program with Maple, so please don't laugh.

I've posted the Maple code below:

*restart; randomize():*

*with(plots): with(plottools): with(LinearAlgebra): with(Statistics): with(MTM): *

*s:={1=2, 3=2}:*

*Realisierung:=proc(np,volfrac)*

*local m, h, adresses, rndmAdrs, omega: omega:=Vector[row](np,s);*

*adresses:=Vector(np-nops(s));*

*h:=1;*

*for m from 1 to np do *

*if(omega[m]=0) then *

*adresses[h]:=m;*

*h:=h+1;*

*end if*

* od;*

*randomize():*

*rndmAdrs:=Shuffle(adresses);*

*for m from 1 to volfrac*np do*

*omega[rndmAdrs[m]]:=1*

*od:*

*for m from 1 to np -(volfrac*np+nops(s)) do*

*omega[rndmAdrs[m+int8(volfrac*np)]]:=2*

*od: *

*omega; *

*end:*

*RealMatrix:=proc(np,nr,volfrac) *

*local m, alle: *

*alle:=Matrix(nr,np); for m from 1 to nr do *

*randomize(); *

*alle[m]:=Realisierung(np,volfrac); od; *

*alle; *

*end:*

*RealMatrix(5,5,0.4);*

I used the Shuffle function from Statistics-package to randomly permutate the components in the Vector adresses. Which works fine. By setting Randomize(); I get randomly results vor this permutation, when I execute the whole worksheet.

But when the "Realisierung" procedure is called in the for loop of the "RealMatrix" procedure, always the same Permutation is calculated.

This leads to the fact, that every row in my matrix looks the same.

Like in the example

2 1 2 2 1

2 1 2 2 1

2 1 2 2 1

2 1 2 2 1

2 1 2 2 1

but the lines should be randmly like

2 1 2 2 1

2 2 2 1 1

2 1 2 1 2

2 1 2 2 1

.....

Obvioulsy the problem is in the randomize()-command. I tried to place it directly after "restart" and directly before the Shuffling is executed.

But I had no succes.

Maybe one of you can help me?

Would be great!

Thanks