954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Shuffling an array randomly

0
By KevinADC on Aug 28th, 2006 1:23 pm

Use the List::Util module. I believe List::Util is a core module starting with perl 5.8. For older versions of perl you may need to install the module. See the module documentation for more details: List::Util

use List::Util 'shuffle';
my @deck = (1..52);
my @shuffled_deck = shuffle(@deck);

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You