LARGE = 1;
SMALL = 0;
state = LARGE; 
large_cnt = 0;
small_cnt = 0;
n= 100000; 
states = zeros(1,n);
for i = 1:n,
	% count instances of large or small packets 
	if state == LARGE
		large_cnt = large_cnt + 1;
	else
		small_cnt = small_cnt + 1;
	end
    states(i) = state;

    r = rand(1);
	if state == LARGE 
		% remain in large state with 0% probability
		if r < 0
			state = LARGE;
	    else 
			state = SMALL;
	    end
    else
		% remain in small state with 85.714% probability
		if r < .85714
			state = SMALL;
	    else 
			state = LARGE;
	    end
	end
end
large_cnt
small_cnt
