function s = final ( )

%*****************************************************************************80
%
%% final() considers ( A^2/3 + B^2/3 <? 1 ) for random A and B.
%
%  Discussion:
%
%    For A and B uniform random in [-1,+1], what is the probability that
%      A^2/3 + B^2/3 < 1?
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    31 January 2018
%
%  Author:
%
%    Paul Nahin
%
%  Reference:
%
%    Paul Nahin,
%    Will You Be Alive 10 Years From Now?,
%    Princeton, 2014,
%    ISBN: 978-0691156804,
%    LC: QA273.25.N344
%
%  Output:
%
%    real S: the estimated probability.
%
  trial_num = 100000;

  s = 0;
  
  for loop = 1 : trial_num

    A = ( - 1 + 2.0 * rand ( ) );
    B = ( - 1 + 2.0 * rand ( ) );
    A = ( A^2 ) ^ ( 1/3 );
    B = ( B^2 ) ^ ( 1/3 );
 
    if ( A + B  < 1 )
      s = s + 1;
    end

  end

  s = s / trial_num;

  return
end
