function imsnp=snp(imw,density);

% imsnp=SNP(imw,density);
%
% 		Adds salt & pepper noise to the image IMW
%
%		density: noise density, 0..1
%
%		e.g.: imsnp=snp(imw,0.03);
%
%
% University of Rhode Island
% Dept. of Electrical Engineering
% Roger Meier, May '99


if or(density < 0,density > 1)
	disp('density must be within [0..1]')
	break
end

imsnp=imnoise(imw,'salt & pepper',density);
