From: <fp...@us...> - 2010-09-07 17:23:46
|
Revision: 7677 http://octave.svn.sourceforge.net/octave/?rev=7677&view=rev Author: fpoto Date: 2010-09-07 17:23:40 +0000 (Tue, 07 Sep 2010) Log Message: ----------- simplify the reseeding code once more Modified Paths: -------------- trunk/octave-forge/main/general/inst/parcellfun.m Modified: trunk/octave-forge/main/general/inst/parcellfun.m =================================================================== --- trunk/octave-forge/main/general/inst/parcellfun.m 2010-09-07 11:22:04 UTC (rev 7676) +++ trunk/octave-forge/main/general/inst/parcellfun.m 2010-09-07 17:23:40 UTC (rev 7677) @@ -137,8 +137,8 @@ fflush (stdout); # prevent subprocesses from inheriting buffered output - ## query rand state. - rstat = rand ("state"); + ## get a seed and change state + seed = rand; pids = zeros (nproc, 1); @@ -206,9 +206,9 @@ unwind_protect try ## re-seed random number states, adjusted for each process - rstat = bitxor (rstat, iproc); + seed *= iproc*bitmax; for f = {(@rand) (@randn) (@rande) (@randp) (@randg)} - feval(f{}, "state", rstat); + feval(f{}, "state", seed); endfor ## child process. indicate ready state. @@ -378,9 +378,6 @@ endif endfor - ## query one random number to avoid restarting from the same state. - rand; - endif endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |