quick formula.
I need to get a random number between a High and a low.
what's the formula??
Printable View
quick formula.
I need to get a random number between a High and a low.
what's the formula??
Code:for(i=0;i<10;i++) printf("%d\n",rand() ); // print some random numbers
with [min, max] being an inclusive range
Code:inline int getrandfromto(int min, int max)
{
return ((rand() % (max-min+1))+min);
}