I'm currently using this function to muddle up all items of an array :
void shuffleArray(int *array)
{
int index;
int buffer
int randomIndex;
srand((int)time(NULL));
//SIZE is my tab's length
for(index = 0; index < SIZE - 1; index++)
{
randomIndex = (index + rand() / (RAND_MAX / SIZE - index) + 1));
buffer = array[randomIndex];
array[randomIndex] = array[index];
array[index] = buffer;
}
}
But I've a problem: The first value of my array is always the same as a function of current time.
I'm lost, if you can show me the right way..