Kirk, Benjamin (JSC-EG311) wrote: > not sure, but on my OSX box the first line of 'man srand' says 'bad random > number generator' > > try 'man random' and try using it. > > also, note that you are seeding it with a granularity in seconds. so > probably the function is called for each node in less than one second - > hence you are seeding the RNG with the same value for each node - hence you > get the same 'random' value. > > try instead seeding the RNG once, say in main(), and then just calling > std::rand() in the initial value function, not std::srand() too. > > -Ben > > > Ohh my god, you just solve my problem with only seconds, which has bothered my three days. I should ask you talented guys on Monday. I very appreciate your help.
Liang ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Libmesh-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-users
