in reply to Re: random index in array - no duplicates
in thread random index in array - no duplicates

One problem with this, however, is that if the array contains multiple elements with the same value, they will still show up multiple times. Best to filter them out first.
  • Comment on Re: Re: random index in array - no duplicates

Replies are listed 'Best First'.
Re: Re: Re: random index in array - no duplicates
by jsprat (Curate) on Jun 08, 2002 at 06:44 UTC
    The OP wrote "but what if I want to be sure that I don't get a duplicate index?"

    I'm pretty sure he was worrying about pulling the same element twice from the array, not worrying about duplicate elements. If there are duplicate elements, yes he would want to weed them out first.