It's about logic, you want a number between 10 and 20, you just actually need the "difference(delta)" between them, 20-10 = you only want a random number from 10, the rest is up to padding, (0 to 10) + 10 padding = (10 to 20)
example:
int GetRandomNumber ( int n1, int n2 )
{
int delta = abs ( n1 - n2 );//get the difference (the abs() will get the absolute value for the delta, so the function returns right output even if you enter (20, 10) rather than (10, 20)
return dbRND ( delta ) + (n1 < n2? n1 : n2); //the padding is after the +, we find the lesser value and pad by it
}
//or shorter
int GetRandomNumber ( int n1, int n2 )
{
return dbRND ( abs ( n1 - n2 ) ) + (n1 < n2? n1 : n2);
}