function x = uniform_in_triangle_bad ( n, v1, v2, v3 )

%*****************************************************************************80
%
%% uniform_in_triangle_bad() maps uniform points into a triangle.
%
%  Discussion:
%
%    This is a bad algorithm, which does not actually produce a good
%    uniform distribution of points.  It is intended as a demonstration.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    12 January 2025
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of points.
%
%    real V1(1,2), V2(1,2), V3(1,2), the vertices.
%
%  Output:
%
%    real X(N,2), the points.
%
  x = zeros ( n, 2 );
%
%  Generate 3 random values, normalize to sum to 1, and use these
%  as barycentric coordinates.
%
  for i = 1 : n

    r = rand ( 3, 1 );
    r = r / sum ( r );

    x(i,1:2) = ( r(1) * v1(1,1:2) ...
               + r(2) * v2(1,1:2) ...
               + r(3) * v3(1,1:2) );

  end

  return
end
