in reply to Re: Trying to get sum of elements in array
in thread Trying to get sum of elements in array

But the result isn't guaranteed to be unique.

If you worry about performance rather use a shuffle approach.

Or use the fact that the order of keys in a hash is random.

Cheers Rolf

PS: Je suis Charlie!

  • Comment on Re^2: Trying to get sum of elements in array

Replies are listed 'Best First'.
Re^3: Trying to get sum of elements in array
by gargle (Chaplain) on Feb 06, 2015 at 12:55 UTC
    Why do these random numbers have to be unique?
    --
    if ( 1 ) { $postman->ring() for (1..2); }
      We've already established that this is a homework assignment. Perhaps uniqueness is one of the assignment's constraints?