function zz = throw(n,m)
% Generate m random events with probability specified by n
% Where n < 1 is the probability of the binary event
% If n>1 it is the number of outcomes, e.g. 6 for dice
% Avoid n=1: it produces a sequence of all ones 
% If m is omitted one event is produced
if (nargin == 1)
  m =1;
endif
if n<1
  zz=zeros(m,1);
  zz(find(rand(m,1)<n))=1;
else
  zz=fix(rand(m,1)*n)+1;
endif



