The code is
return min + static_cast<int>(static_cast<double>(max - min + 1.0) *
(number / (UINT_MAX + 1.0)));
number is a random number obtained by rand_s. min and max are ints and represent minimum and maximum values (inclusive).
If you provide a solution not using unsigned int as a number, please also explain how to make it be random.
Please do not submit solutions using rand().