in reply to Re^4: Is this a fair shuffle?
in thread Is this a fair shuffle?

That's not fair.

I guess it depends upon what the aim is. If you simple want an array shuffled quicky, doing it in place is totally fair.

But it doesn't seem to make a lot of difference in the benchmark time.

As the arrays being shuffled only have 4 elements, the in-placeness makes almost no difference, but once you start shuffling arrays of a few hundred items, it has a fairly dramatic effect.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.
Rule 1 has a caveat! -- Who broke the cabal?

Replies are listed 'Best First'.
Re^6: Is this a fair shuffle?
by Roy Johnson (Monsignor) on Apr 01, 2005 at 11:51 UTC
    Having one algorithm that shuffles in-place and the others that don't is not a fair comparison. As Abigail points out, the void context is a problem; they results should be assigned somewhere. Then the dramatic advantage of sort disappears.

    The speed test wasn't done on 4-element arrays, BTW.

    Odd, all the nodes in this thread list as having negative reps, but in my Nodes you Wrote, they're positive. And I gained XP overnight.


    Caution: Contents may have been coded under pressure.

      I noticed the neg reps in the thread, but mine also show up positive on the list.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco.
      Rule 1 has a caveat! -- Who broke the cabal?
        Oh, dang, look at the calendar! I've got to run!

        Caution: Contents may have been coded under pressure.