%!


% what re the odds of an underflow of 1 - .15b for range of 0 to 255?


(C:\\Documents and Settings\\don\\Desktop\\gonzo\\gonzo.ps) run  % use internal 

% ========

/guru { gonzo begin
ps.util.1 begin printerror nuisance begin} def   

 guru                                           % optionally activate gonzo utilities

% =========

% make a real model


/aa  -1 store

/b0 { tt dup dup mul mul aa mul     
      tt dup mul -2 mul aa mul             add   
      tt aa mul                           add} store

/b1 { tt dup dup mul mul aa 2 add mul
      tt dup mul aa 3 add neg mul  1 add      add } store

/b2 { tt dup dup mul mul aa 2 add neg mul
      tt dup mul  aa 2 mul 3 add  mul                add
      aa neg tt mul add} store

/b3 { tt dup dup mul mul aa neg mul
      tt dup mul aa mul add              } store 



/trips 100000 store




10  {

/negs 0 store

mark
trips {  

/tt 1000 random 1000 div store



/x0 256 random b0 mul cvi store 
/x1 256 random b1 mul cvi store
/x2 256 random b2 mul cvi store
/x3 256 random b3 mul cvi store



x0 x1 x2 x3 add add add   dup 0 lt {  /negs negs 1 add store  }{pop} ifelse






} repeat

] /curneglist exch store

0 curneglist {add} forall curneglist length div 

(\n\nAverage negative is ) print flush ==

(Odds on negative are ) print flush  negs trips div ==



} repeat


% eof