% jleonard 3/10/02   13.002J/10.002J

function result = break_stick;

w = rand(1); % point of first break
x = w*rand(1);
y = w-x;
z = 1-w;

if ((x>0.5) | (y>0.5) | (z > 0.5))
  result = 0;
else
  result = 1;
end

fprintf('x=%.4f, y=%.4f, z=%.4f, sum=%.4f, result=%d\n', x, y, z, ...
	x+y+z, result);
