function v = coin_biased ( n, heads )

%*****************************************************************************80
%
%% coin_biased() generates N biased random coin flips.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 September 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of tosses.
%
%    real HEADS, the probability of heads with this coin.
%    0.0 <= HEADS <= 1.0.
%
%  Output:
%
%    integer V(N), a vector of -1's for tails, and 1's for heads.
%
% rng ( 'shuffle' );

  v = ( rand ( n, 1 ) < heads );

  v = 2.0 * v - 1.0;

  return
end
