function indx = florida_sample_pop ( n, cdf )

%*****************************************************************************80
%
%% florida_sample_pop() randomly samples the Florida population data.
%
%  Discussion:
%
%    M census districts have been given, and for each district,
%    a total population was listed.
%
%    A CDF vector CDF(1:M+1) was created, such that CDF(I) is the probability
%    that a person resides in a district of index less than or equal to I.
%
%    We now ask for N random samples of the population, which means we will
%    return N values I between 1 and M, selected randomly and weighted by
%    population.
%
%    We will make use of MATLAB's discretize() function:
%      r = rand ( n )
%      indx = discretize ( r, cdf )
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 July 2016
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of random samples requested.
%
%    real CDF(M+1), the CDF for the population.
%
%  Output:
%
%    integer INDX(N), a sequence of indices between 1 and N.
%
  r = rand ( n, 1 );

  indx = discretize ( r, cdf );

  return
end

