I need to generate random numbers within a specified interval, [max;min].
Also, the random numbers should be uniformly distributed over the interval, not located to
You should look at RAND_MAX
for your particular compiler/environment.
I think you would see these results if rand()
is producing a random 16-bit number. (you seem to be assuming it will be a 32-bit number).
I can't promise this is the answer, but please post your value of RAND_MAX
, and a little more detail on your environment.