Perl Monk, Perl Meditation | |
PerlMonks |
Re: Random shufflingby johngg (Canon) |
on Jun 20, 2015 at 23:11 UTC ( [id://1131307]=note: print w/replies, xml ) | Need Help?? |
As hexcoder says, you only need to read two lines at a time. Rather than using C-style loops to move along the sequence shuffling as you go you could use unpack and map; as BrowserUk has observed, there seems to be no point in shuffling more than once.
I hope this is of interest. Update: Corrected cut'n'paste error in script, I was erroneously unpacking $shuffled instead of $seq. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|