http://www.perlmonks.org?node_id=219912


in reply to Re: Re: random number
in thread random number

#splice is still O(n) $array[$index] = $array[-1]; pop @array;

Replies are listed 'Best First'.
Re: Re: Re: Re: random number
by BrowserUk (Patriarch) on Dec 15, 2002 at 00:19 UTC

    True. And that's a neat solution.

    It would still be better to shuffle the array and simply pop the next one when you need it as was suggested at near the top of the thread.


    Examine what is said, not who speaks.