I did it in the following way, I hope it helps.
prontera,161,181,5 script Test Code 112,{
//delete arrays permanent in npc
deletearray .resultn[0],getarraysize(.resultn);
deletearray .result$[0],getarraysize(.result$);
for(set .@i,1; .@i<=3; set .@i,.@i+1)
{
switch(.@i)
{
//arrays temporary
case 1: setarray .@arrayn[1],1,2,3,4,5; setarray .@array$[1],"a","b","c","d","e"; break;
case 2: setarray .@arrayn[1],6,7,8,9,10,11; setarray .@array$[1],"f","g","h","i","j","k"; break;
case 3: setarray .@arrayn[1],12,13,14,15; setarray .@array$[1],"l","m","n","o"; break;
}
//Save values
setarray .resultn[.@i],.@arrayn[rand(1,getarraysize(.@arrayn)-1)];
setarray .result$[.@i],.@array$[rand(1,getarraysize(.@array$)-1)];
//show values
dispbottom ".resultn value["+.@i+"]: "+.resultn[.@i];
dispbottom ".result$ value["+.@i+"]: "+.result$[.@i]+"";
//delete array temporary
deletearray .@arrayn[0],getarraysize(.@arrayn);
deletearray .@array$[0],getarraysize(.@array$);
}
end;
}