%this code draws two random integers between 1 and 4, the result si strored %in r % if the result in r is (2,1) or (1,2) then the counter is increased by 1 counter=0; r=floor(rand(1,2)*4+1) if((r(1)==1&r(2)==2)|(r(1)==2&r(2)==1)) counter=counter+1; end counter