sub shuffle($$$) { my ($seed, $max, $input) = @_; # $max > $input # $max > 0 # $input >= 0 my $result; # calculate $result # $result >= 0 # $result < $max return $result } #### get_rand(\@$$) { my ($list, $seed, $input) = @_; return $list->[shuffle($seed, scalar(@$list), $input)]; } my $list = [10, 20, 30, 40, 50, 60]; for (my $i = 0; $i < scalar(@$list); $i++) { print get_rand($list, 42, $i) . ' '; } # might print 40 10 20 60 30 50