prontera,155,185,5 script Haru shuffle 1_F_MARIA,{ freeloop true; .@start = gettimetick(0); callfunc "Haru_shuffle", 1000, .@output; .@end = gettimetick(0); dispbottom "time used = "+( .@end - .@start )+" mili-seconds"; end; } prontera,158,185,5 script keyworld inf shuffle 1_F_MARIA,{ freeloop true; .@start = gettimetick(0); callfunc "keyworld_inf_shuffle", 1000, .@output; .@end = gettimetick(0); dispbottom "time used = "+( .@end - .@start )+" mili-seconds"; end; } prontera,152,185,5 script modern fisher yates 1_F_MARIA,{ freeloop true; .@start = gettimetick(0); callfunc "modern_fisher_yates", 1000, .@output; .@end = gettimetick(0); dispbottom "time used = "+( .@end - .@start )+" mili-seconds"; end; } function script Haru_shuffle { deletearray getarg(1); .@count = getarg(0); for ( .@i = 0; .@i < .@count; ++.@i ) { do { .@pick = rand( .@count ); } while ( .@flags[.@pick] ); set getelementofarray( getarg(1), .@i ), .@pick; .@flags[.@pick] = 1; } return .@size; } function script keyworld_inf_shuffle { deletearray getarg(1); .@count = getarg(0); .@tmp$ = "|"; for ( .@i = 0; .@i < .@count; ++.@i ) { while ( compare( .@tmp$, "|" +( .@pick = rand( .@count ) )+ "|" ) ); set getelementofarray( getarg(1), .@i ), .@pick; .@tmp$ += .@pick +"|"; } return .@size; } function script modern_fisher_yates { deletearray getarg(1); .@size = .@tmpsize = getarg(0); if ( .@size <= 0 ) return 0; for ( .@i = 0; .@i < .@size; ++.@i ) .@array_[.@i] = .@i; for ( .@i = 0; .@i < .@size; ++.@i ) { .@rand = rand(.@tmpsize); set getelementofarray( getarg(1), .@i ), .@array_[.@rand]; deletearray .@array_[.@rand], 1; --.@tmpsize; } return .@size; }