<p>I need to generate random numbers within a specified interval, [max;min].</p>

<p>Also, the random numbers should be uniformly distributed over the interval, not located to a particular point.</p>

<p>Currenly I am generating as:</p>

<pre><code>for(int i=0; i&lt;6; i++)
{
    DWORD random = rand()%(max-min+1) + min;
}
</code></pre>

<p>From my tests, random numbers are generated around one point only.</p>

<pre><code>Example
min = 3604607;
max = 7654607;
</code></pre>

<p>Random numbers generated:</p>

<pre><code>3631594
3609293
3630000
3628441
3636376
3621404
</code></pre>

<p>From answers below: OK, RAND_MAX is 32767. I am on C++ Windows platform. Is there any other method to generate random numbers with a uniform distribution?</p>

If you want numbers to be uniformly distributed over the range, you should break your range up into a number of equal sections that represent the number of points you need. Then get a random number with a min/max for each section.
As another note, you should probably not use
```
rand()
```
as it's not very good at actually generating random numbers. I don't know what platform you're running on, but there is probably a better function you can call like
```
random()
```
.