in reply to Re^2: Randomising the order of an array
in thread Randomising the order of an array

Your solution is not guaranteed to be well shuffled since you relying on sort to shuffle ties.
But you do know the period of repetition for rand(), right? ;-)

Replies are listed 'Best First'.
Re^4: Randomising the order of an array
by ikegami (Patriarch) on Jul 19, 2005 at 20:07 UTC
    Numbers can repeat more often than rand's period, but you're right, it won't happen often.
      Numbers can repeat more often than rand's period, but you're right, it won't happen often.
      I haven't check the actual source code, but I'm fairly confident that if your perl is using drand48, you won't get repeats any sooner than the period of the RNG (2**48).