in reply to Re: Randomize word
in thread Randomize word

Your tired and gonna kick yourself :)

print "Word is: ", join '', @{ fisher_yates_shuffle( [ split '', "iguana" ] ) };

Of course, you'd have to return the reference passed in though.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^3: Randomize word
by Nkuvu (Priest) on Sep 08, 2004 at 01:43 UTC
    You are correct on the tired bit. And thanks for the correct syntax -- must have been a mental block on this when I was looking at it earlier.

    I do remember trying bizarre things like @( split '', "iguana") and I'm not sure why I thought that would work. I suppose I should just stick to my original overtired excuse. I was, after all, looking at the sunrise from the wrong side (as in, I was up all night, and went to bed shortly after posting this).

      We all have nights like that--least I do :0 (that's a yawn!).

      Funny thing with me is that there is a sweet spot between getting tired, and becoming incapable. It varies between 1/2 hour and a couple of hours in which everything just seems to click. I can be more productive in that time than throughout the rest of the day. The problem is recognising when I transition from the state of grace to "what a state". It's not always obvious to me at the time, as there are a few indicators around this site.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon