in reply to RE (tilly) 2: Randomize an array
in thread Randomize an array
I completely agree with you. 0 should not be here. It's just that we talked about
at the september 1999 Paris.pm meeting.sort { rand(3) - 1 } @array
I just remembered the sort rand trick and shared it. So here comes an updated version:
sort { (-1,1)[rand 2] } @array
In Section
Seekers of Perl Wisdom