Search this blog

mercredi 17 février 2010

Perl: how to shuffle an array

If you either have Perl 5.8.0 or later installed, or if you have Scalar-List-Utils 1.03 or later installed, you can say:

use List::Util 'shuffle'; @shuffled = shuffle(@list);

Aucun commentaire:

Enregistrer un commentaire