Does anyone know of an algorithm that will visit each element of a collection, lets say an array, once only but in a pseudo random manner?
My array has potentially many many elements (i.e. 2^28) so storing which elements that have been visited nor generating a random index sequence are viable options.
I am hoping that there is an algorithm, given a random seed will and the current loop count will give the next element index with the constraint that index returned is unique and thus will achieve coverage over all elements when the loop count == the number of elements in the array.
i.e.
long seed = new Random().nextLong();
for (i=0;array.length;i++)
{
int index = nextIndex(long,i);
Object element = array.get(index);
// use element
}