function result = p00_monte_carlo ( problem, order )

%*****************************************************************************80
%
%% p00_monte_carlo() applies a Monte Carlo procedure to Hermite integrals.
%
%  Discussion:
%
%    We wish to estimate the integral:
%
%      I(f) = integral ( -oo < x < +oo ) f(x) exp ( - x * x ) dx
%
%    We do this by a Monte Carlo sampling procedure, in which
%    we select N points X(1:N) from a standard normal distribution,
%    and estimate
%
%      Q(f) = sum ( 1 <= I <= N ) f(x(i)) / sqrt ( pi )
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 May 2010
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer PROBLEM, the index of the problem.
%
%    integer ORDER, the order of the Gauss-Laguerre rule
%    to apply.
%
%  Output:
%
%    real RESULT, the approximate integral.
%
  x_vec = randn ( order, 1 );

  option = 2;
  f_vec = p00_fun ( problem, option, order, x_vec );

  weight = order / sqrt ( 2.0 * pi );

  result = sum ( f_vec(1:order) ) / weight;

  return
end
