viewing paste pull/872 - Haru vs keyworld infinit | 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
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;
}
Viewed 1467 times, submitted by AnnieRuru.