// callfunc "shuffle", , , {, }; function script shuffle__ { .@static = getarg(0); .@range = getarg(1) +1 - .@static; .@count = getarg(3, 0); if ( .@range <= 0 ) return 0; if ( !.@count || .@count > .@range ) .@count = .@range; while ( .@i < .@count ) { .@r = .@save = rand( .@i, .@range -1 ) ; if ( !.@tmp1[.@i] ) { .@r = .@tmp1[.@r] ? .@tmp2[.@r] : .@r; .@tmp2[.@i] = .@r; .@tmp2[.@save] = .@i; .@tmp1[.@save] = 1; set getelementofarray( getarg(2), .@i ), .@r + .@static; if ( .@save < .@count ) set getelementofarray( getarg(2), .@save ), .@i + .@static; } .@i++; } return .@count; } /* prontera,156,184,5 script kjdshfksfjh 100,{ // input .@min, -1000000000, 1000000000; // input .@max, -1000000000, 1000000000; .@min = 1; .@max = 5; callfunc "shuffle__", .@min, .@max, .@output$, 100; dispbottom implode( .@output$, "," ); } */