viewing paste topic/14817- meko shuffle array | Athena

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
poring_w01,100,100,5    script  test_mail       1_F_MARIA,{
        setarray .@a$, "0","1","2","3";
        setarray .@resultset$,
                "0,1,2,3","0,1,3,2","0,2,1,3","0,2,3,1","0,3,1,2","0,3,2,1",
                "1,0,2,3","1,0,3,2","1,2,0,3","1,2,3,0","1,3,0,2","1,3,2,0",
                "2,0,1,3","2,0,3,1","2,1,0,3","2,1,3,0","2,3,1,0","2,3,0,1",
                "3,0,1,2","3,0,2,1","3,1,0,2","3,1,2,0","3,2,0,1","3,2,1,0";
        .@loop = 2400;
        for ( .@l = 0; .@l < .@loop; ++.@l ) {
                copyarray .@b$, .@a$, 4;
                array_shuffle(.@b$);
                freeloop true;
                for ( .@i = 0; .@i < 24; ++.@i ) {
                        .@print$ = implode( .@b$, "," );
                        if ( .@print$ == .@resultset$[.@i] ) {
                                ++.@resultset[.@i];
                                break;
                        }
                }
        }
        for ( .@i = 0; .@i < 24; ++.@i ) {
                dispbottom "result set "+( .@i +1 )+" '"+ .@resultset$[.@i] +"' has "+ .@resultset[.@i] +" times.";
                .@total += .@resultset[.@i];
        }
        dispbottom "total = "+ .@total;
        end;
}
Viewed 131 times, submitted by AnnieRuru.