Alright so this my code for the shuffle so far. I am making a team randomizer with a max of 250 teams and it is 4 players per team.
Code:
srand ( time(NULL) );
for(i=0;i<(Teams*4);i++)
{
int random = rand() % (Teams * 4);
strcpy(temp.x[0].name, player.x[i].name);
strcpy(player.x[i].name, player.x[random].name);
strcpy(player.x[random].name, temp.x[0].name);
}
for(i=0;i<Teams;i++)
{
printf("-------------\nTeam %d\n--------------\n %s \n %s \n %s \n %s \n", i+1,player.x[i].name, player.x[i+1].name, player.x[i+2].name, player.x[i+3].name);
}
It shuffles good and all that, the only problem is that a player may be put down on the same team twice. I have been searching and searching and well being new, I have tried everything i can think of. So, any pointers