FUNCTION REFERENCE
sprand
Random sparse matrix with uniformly distributed stored values.
Random sparse matrix with uniformly distributed stored values.
Syntax
S = sprand(m, n, density)Syntax
R = sprand(S)Draws round(density*m*n) positions, merges duplicate draws, and stores uniform values strictly between 0 and 1. The one-input form keeps the nonzero pattern of S.
Example
S = sprand(4, 5, 0.3); issparse(S)Differences from MATLAB: Positions are drawn first and values second, so the random-stream consumption is documented and deterministic here.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.