For those who are only sorting a deck of cards (a very popular subset of shuffling), this may be sufficient ;-)Well, about all you gain is 50 microseconds. The 'shuffle' sub isn't significant smaller or easier to understand than 'random_perm'. They are both four lines of code, not counting lines consisting of just closing braces.
There isn't a real argument to not choose a solution that scales. If 50 microseconds are important to you, you should have used List::Util::scalar in the first place.
In reply to Re^2: A bad shuffle
by Anonymous Monk
in thread A bad shuffle
by tlm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |