in reply to Re: Re: Re: Re: Re: Re: Choose random element of array?
in thread Choose random element of array?
Remember, I said the loop you had was a shuffle. Both the Fisher-Yates and yours are examples of shuffle algorithms. As such, each element in the original data structure is copied exactly once into the result, in a random position.
So, yes, that would be the case with the Fisher-Yates algorithm.
|
|---|