Leave a commentApril 21 | 2009

Found this over atĀ daveoncode and thought i would like to share it:

1
2
3
4
5
6
7
8
9
10
private function _getRandom(arr:Array):void

    var arr2:Array = new Array();

    while (arr.length > 0) {
        arr2.push(arr.splice(Math.round(Math.random() * (arr.length - 1)), 1)[0]);
    }

    return arr2;
}
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Ma.gnolia
  • Tumblr
  • TwitThis
  • StumbleUpon