Documentation

distributed.sprand

Create distributed sparse array of uniformly distributed pseudo-random values

Syntax

DS = distributed.sprand(m,n,density)

Description

DS = distributed.sprand(m,n,density)creates anm-by-nsparse distributed array with approximatelydensity*m*nuniformly distributed nonzero double entries.

Examples

Create a 1000-by-1000 sparse distributed double arrayDSwith approximately 1000 nonzeros.

DS = distributed.sprand(1000,1000,0.001);

Tips

When you usesprandon 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 thelabindexor 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.

Introduced in R2009b