You get the same result in both processes because you initialize the pseudo-random number generator before you fork, thus the child inherits the seed from its parent. You have to call srand() after...