I don't know about your .L[3], and it looks like that Kurofly has answered your second question?
setarray .M1,1,2,3;
setarray .M2,4,5,6;
setarray .M3,7,8,9;
for (.@e = 0; .@e<4; .@e++) {
set .@r,rand(1,.L[3]);
set .@s[.@e],getd(".M"+.@r+"["+rand(getarraysize(getd(".M"+.@r)))+"]";
}