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 reply to RE: RE (tilly) 2: Randomize an array
by BooK
in thread Randomize an array
by Zebu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |