3
For a schoolwork, I need to create a game, for which I need to generate a random number to make it fair. In one case, as I will post below, I need to assign a random number between 0 and 2 to modify in the string:
int NUM, AUX;
char PORTAS [0] = {'N', 'N', 'N'};
printf ("Entre com o número de participantes: ");
scanf ("%i", &NUM);
PART JOG [NUM];
for ( AUX = 0 ; AUX < NUM ; AUX++ ){
ent_info (&JOG [AUX], AUX);
}
AUX = rand () %3;
PORTAS [AUX] = 'S';
The problem is that every time, AUX receives the number 2 and I need to generate two other random numbers besides that. How can I get around this problem? Thank you.
Put other parts of the code, especially where the random seed is starting. The problem must be there.
– Maniero