User`s guide

codistributed.sprandn
11-39
spmd(4)
CS = codistributed.sprandn(1000, 1000, .001);
end
creates a 1000-by-1000 sparse codistributed double array CS with approximately 1000
nonzeros. CS is distributed by its second dimension (columns), and each worker contains
a 1000-by-250 local piece of CS.
spmd(4)
codist = codistributor1d(2, 1:numlabs);
CS = sprandn(10, 10, .1, codist);
end
creates a 10-by-10 codistributed double array CS with approximately 10 nonzeros. CS is
distributed by its columns, and each worker contains a 10-by-labindex local piece of CS.
More About
Tips
When you use sprandn on the workers in the parallel pool, or in an independent or
communicating job (including pmode), each worker sets its random generator seed to
a value that depends only on the labindex or task ID. Therefore, the array on each
worker is unique for that job. However, if you repeat the job, you get the same random
data.
See Also
sprandn | rand | randn | sparse | codistributed.speye |
codistributed.sprand | distributed.sprandn