0
Random numbers from -20 to 20
#define LEFT -20 #define RIGHT 20 if we do some_variable=rand()%RIGHT+LEFT - we get random numbers from 0 to -20; but if i try to do soem_variable=rand%(2*RIGHT)+LEFT - i still dont get numbers from -20 to 20 interval. Pretty dumb question but i really forgot how to do this
2 Respostas
+ 5
rand()%(Right- Left +1)+Left
+ 1
Thank you!