function p = obtuse1 ( )

%*****************************************************************************80
%
%% obtuse1 estimates the probability of an obtuse triangle.
%
%  Discussion:
%
%    A triangle has a side of length s1 = 1.  Choose the lengths of the other
%    two sides s2 and s3 uniformly at random, and proceed only if these sides 
%    create a triangle.  Determine the probability the triangle is obtuse.
%
%  Modified:
%
%    08 May 2019
%
%  Author:
%
%    Paul Nahin
%
%  Reference:
%
%    Paul Nahin,
%    Will You Be Alive 10 Years From Now?,
%    Princeton, 2014,
%    ISBN: 978-0691156804,
%    LC: QA273.25.N344
%
%  Parameters:
%
%    Output, real p, the probability of creating an obtuse triangle.
%
  obtuse = 0;
  triangle = 0;
  triangle_num = 10000000;

  while ( triangle < triangle_num )
    s2 = rand ( );
    s3 = rand ( );
    if ( 1.0 < s2 + s3 )
      triangle = triangle + 1;
      if ( s2^2 + s3^2 < 1.0 )
        obtuse = obtuse + 1;
      end
    end
  end

  p = obtuse / triangle_num;

  return
end
