p=0.4;
y=rand(1)
if y < p then x = 1;
  elseif (y>=p & y < 0.8) then x = 0;
  else x=-1;
end;
x
