Laserallan is the way to go.
For a vector with 10 elements and 70% units that are randomly distributed, you write
randVec = rand(10,1)<0.7;
EDIT , X- N, ,
thresVec = linspace(0,1,X); %
randVec = bsxfun(@lt,rand(N,X),threshVec); %
, randVec - . , , double ,
randVec = double(randVec);