Here is the documentation of the various options. Here is one way to do something close.
numWorkers = matlabpool('size');
[streams{1:numWorkers}] = RandStream.create('mrg32k3a', ...
'Seed', 'shuffle', 'NumStreams', numWorkers);
spmd
RandStream.setGlobalStream(streams{labindex});
end
Or, to avoid creating all threads on the client, you can do this instead:
rng('shuffle'); % shuffle the client
workerSeed = randi([0, 2^32-1]);
spmd
stream = RandStream.create('mrg32k3a', ...
'Seed', workerSeed, ...
'NumStreams', numlabs, ...
'StreamIndices', labindex);
RandStream.setGlobalStream(stream);
end
Edric source
share