function [ res ] = Fattente(X,p,q )

Y=rand(1)<p;
if (X==0) then res=Y;
    else Z=rand(1)<q;
        res=X+Y-Z;
end;

endfunction

