#!/usr/bin/perl use strict; use warnings; #...get a seed open(RANDOM, "<", "/dev/random") || die $!; read(RANDOM, $_, 4); close RANDOM; srand(unpack("L", $_)); #...do the shuffle my @k = ( 1..10 ); for ( my $i = @k ; --$i ; ) { my $j = int( rand( $i + 1 ) ); next if $i == $j; @k[ $i, $j ] = @k[ $j, $i ]; } print join( " ", @k) . qq(\n); #...and give your custom sort a chance