Просто умираю, ребят кто-нить знает почему такая фигня получается??

Код:
NoResources = 6;
NoProcesses = 5;
// total number of resources
AvailI = new Array();
AvailI[NoResources];
AvCons = new Array();
AvCons[4, 5, 16, 2, 12, 64];
AvailI = AvCons;
// initialization of available resources in the system
// fill up the array for the number of max resources
MaxI = new Array();
for (i=0; i<NoProcesses; i++) {
MaxI[i] = new Array();
for (j=0; j<NoResources; j++) {
MaxI[i][j] = random(AvailI[j]);
trace (MaxI[i][j]);
}
}
В трейс выдает сплошные нули

А когда меняю строчку

Код:
MaxI[i][j] = random(AvailI[j]);
на

Код:
MaxI[i][j] = random(65);
все работает, ну как мне это сделать

помогите пожалуйста
