Array::Shuffle - fast shuffling of arrays in-place
use Array::Shuffle qw(shuffle_array); shuffle_array(@a);
This module provide some functions for shuffling arrays in-place efficiently.
Shuffles the given array in-place using the Fisher-Yates algorithm that is O(N).
This function is an order of magnitude faster than the shuffle function from List::Util.
Shuffles the given array in-place using an algorithm that is O(NlogN) but more cache friendly than Fisher-Yates. In some extreme cases, when shuffling huge arrays that do not find in the available RAM it may perform better.
You would like to do some benchmarking to find out which one is better suited for your particular case.
The following thread on PerlMonks for a discussion on the topic: http://perlmonks.org/?node_id=953607.
Copyright (C) 2012 by Salvador Fandiño (email@example.com)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.