Hello, how do I use the rand()
function with the range Y ∈ [11, height + 9] and X ∈ [11, width-1].
srand (time(NULL));
y=rand() % ((altura+9)-11) + 11;
x=rand() % ((largura-1)-11) + 11;
gotoXY(x, y);
cout<<"o";
Is it like this? It is happening that you are generating many repeated numbers, the range should be large
Only fill this space in a for(;;)
cycle in half a minute, where width = 70 and height = 25:
One of the problems is to execute this code in a loop, if I take out srand (time(NULL));
Can already generate the numbers well, but if I close the program and reopen it will generate with the same pattern, which I did not want