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 On 3/16/10 6:42 PM, "Liang" <[email protected]> wrote: > There is another question on the setting of initial condition, is that > possible to set the random number to the variable on each node? I put a > rand() in the function of "exact_solution", it returns the same value to > all nodes as shown on bottom. the system.project_solution function may > only return the single exact_value to all the nodes, so I am thinking > add a loop over system.project_solution may solve this problem, but the > number of node and node ID are unknown to me, so which c++ files contain > these information or any other ideas to assign random initial conditions > to variable? Thanks a lot! ------------------------------------------------------------------------------ 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
