function D = sprand( varargin )
%DISTRIBUTED.SPRAND Sparse uniformly distributed random distributed matrix
%   
%   D = DISTRIBUTED.SPRAND(S) has the same sparsity structure as S, but uniformly
%   distributed random entries. 
%   
%   D = DISTRIBUTED.SPRAND(M,N,DENSITY) is a random M-by-N sparse
%   distributed matrix with approximately DENSITY*M*N uniformly
%   distributed nonzero entries. 
%   
%   Example:
%       N = 1000;
%       D = distributed.sprand(N, N, 0.01);
%   
%   See also SPRAND, DISTRIBUTED.
%   
%   


%   Copyright 2008-2020 The MathWorks, Inc.

% static method of distributed

% If only one input, treat as instance form, otherwise use static builder.
if nargin==1
    A = varargin{1};
    if ~isa(A,'distributed')
        A = distributed(A);
    end
    D = distributedutil.distributedSpmdWrapper( @sprand, A );
else
    D = distributed.sBuild( @codistributed.sprand, 'sprand', varargin{:} );
end
end
