p=0.2; n=1; z=rand(1,1,'uniform'); while( z < 1-p) do z=rand(1,1,'uniform'); n=n+1;end n n1=0; while %t do /// \sleftarrow{\normalfont infinite loop, need a \verb+break+ to quit the \verb+while+} z1=rand(1,1,'uniform'); n1= n1+1; if ( z1 >= 1-p) then break;end end n1