ulfben icon

Array Shuffle (KFA)

ulfben | PRO | 12/07/15 11:13:05 PM UTC | 0 ⭐ | 10956 👁️ | Never ⏰ | []
ActionScript 3 |

0 B

|

None

|

0 👍

/

0 👎

//http://blog.codinghorror.com/the-danger-of-naivete/
//Knuth-Fisher-Yates shuffle
function shuffle(array:Array):Array
{
    var m:int = array.length;
    var t:*;
    var i:int;
    
    while (m){ // While there remain elements to shuffle…
        i = Math.floor(Math.random() * m--);     // Pick a remaining element…
        t = array[m]; // And swap it with the current element.
        array[m] = array[i];
        array[i] = t;
    }
    return array;
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  • Rteuixl icon
    04/02/26 04:32:07 PM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
     Remove the @ 
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎