This is an implementation dependent behaviour.
For instance, POSIX.1-2001 gives the following example of an implementation of rand() and srand()
static unsigned long next = 1;
/* RAND_MAX assumed to be 32767 */
int myrand(void) {
next = next * 1103515245 + 12345;
return((unsigned)(next/65536) % 32768);
}
void mysrand(unsigned seed) {
next = seed;
}
Now, if you use this implementation you will end up with:
0
16838
for srand(0)
and srand(1)
respectively.
ref.:
http://linux.die.net/man/3/rand
I ran into a quite similar problem before, where rand()
yielded different sequences for the same seed across different platforms. Lesson learned, portable code should implement his own PRNG.