Axel <ax************************@netcourrier.com> scribbled the following:
Hello
I m trying to having X child process from 1 original process to generate
random numbers.
I m using (1+(int) (10.0*rand()/(RAND_MAX+1.0))) from the man page of
rand() /random().
The problem is that all these childs give as result the absolutly same
value.
Why ? Is it possible to have X forked childs giving different random
values ?
Without delving into the platform-specific process-spawning stuff, I
think it's most likely that all your children are getting seeded with
the same seed, thus the PRNG (pseudo-random number generator) generates
the same pseudo-random numbers. Look up srand().
--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\--
http://www.helsinki.fi/~palaste --------------------- rules! --------/
"I am looking for myself. Have you seen me somewhere?"
- Anon