The non-biased version you showed has a name, it is the Fisher-Yates shuffle. You can learn about the algorythm ib the original publishing
Statistical Tables, from 1938, or in Knuth's
The Art of Computer Programming, vol2, and I believe the
Perl Cookbook. You can use the Tie::Pick module, which has a variant of the FY, or, Algorithm::Numerical::Shuffle, which uses FY:
use Algorithm::Numerical::Shuffle qw(shuffle);
my @array = shuffle qw /one two three four/;
Algorythms using splice() can be slower for larger arrays.
Cheers,
KM