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
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.