This is similar to a shuffle routine I wrote in college. Basically, you swap two elements in the array at random. I used to do this n^2 times, but since you have so many elements, that may not be too effective for you. Instead I took a cue from cciulla's post and perform n swaps. For 170,000 elements, it didn't take too long to run on my end.
my @shuffledList = &shuffle(1..170000);
sub shuffle {
my @sl = @_; # soon to be Sorted List
for my $i ( 1..$#sl ) {
my $x = int(rand() * $#sl);
my $y = int(rand() * $#sl);
($sl[$x], $sl[$y]) = ($sl[$y], $sl[$x]);
}
return @sl;
}
Hope this helps.