Can anyone help me figure out what's wrong with my shuffle function?
It shuffles some songs, yet completely gets rid of others.
Here's the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
void shuffle() //Shuffles songs into a random order.
{
Music temp, temp2; //Temporary music file holders, 'Music' is a struct with string title;, string artist;, and int size;.
unsignedint currentTime = (unsigned)time(0);
srand(currentTime);
for (int i = 0; i < NUM_SONGS; i++)
{
songs[i] = temp;
i = (rand() % NUM_SONGS);
songs[i] = temp2;
temp = songs[i];
i = (rand() % NUM_SONGS);
temp2 = songs[i];
}
}