spot=(rand() % 6 ) +spot;
What do i put so that it doesnt go below 1?
You add one
rand() % 6 + 1
This will give a random number in the range 1-6.
I don't think there is a way. Try using an
if condition:
1 2
|
if(((spot = (rand() % 6)) + spot) < 1)
spot = 1;
|
Edit:
Peter87's solution is better :)
Wazzak
Last edited on
Ty peter that worked perfectly