rand() creates a uniform (pseudo) random distribution.
The actual requirement, from C standard (3.7 MB PDF), section 7.20.2.1, is:
The rand function computes a sequence of pseudo-random integers ranging from 0 to RAND_MAX .
where RAND_MAX is at least 32767. This is admittedly vague, but the goal is to give you an even distribution - and in practice, what it actually implements.
The standard provides an example implementation, but the C implementation is not required to use it.
In practice, there are, of course, the best random number generators. And one specific requirement for rand() is that it must produce exactly the same sequence of numbers for a given seed ( srand() argument). Your description does not mean that it will be a problem for you.
One of the problems is that rand() gives evenly distributed numbers in a fixed range. If you need numbers in a different range, you need to do extra work. For example, if RAND_MAX is 32767, then rand() can display 32768 different values; you cannot get random numbers in the range 0..9 without discarding some values, since there is no way to evenly distribute these 32768 different values ββinto 10 codes of equal size.
Other PRNGs are more likely to give you better results than rand() , but they will still be subject to the same problems.
As usual, the comp.lang.c FAQ answers this better than I do; see questions from 13.15 to 13.21.
Keith thompson
source share