Aside from not being a fair shuffle (8 paths mapped to 6 end states) I believe it can actually cause older perls to dump core.@random = sort { .5 <=> rand(1) } @array; # DO NOT USE THIS!
Sorting assumes a transitive ranking function... If A > B and B > C then A > C. Returning random numbers for your comparison results wont comply with this requirement, and can wreak havoc depending on the internal sorting implementation.
-Blake
In reply to Re: When the Best Solution Isn't
by blakem
in thread When the Best Solution Isn't
by sauoq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |