function a = monotone_vector_random ( d, b )

%*****************************************************************************80
%
%% monotone_vector_random() generates a random monotone vector.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    31 October 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer d: the vector dimension.
%
%    integer B, the base to be used.  B = 2 will
%    give vectors of 1's and 2's, for instance.
%
%  Output:
%
%    integer A(D), the random monotone vector.
%
  a = zeros ( 1, d );
  a(1) = randi ( [ 1, b ], 1 );
% a(1) = randsample ( b, 1 );
  for i = 2 : d
    a(i) = randi ( [ a(i-1), b ], 1 );
%   a(i) = a(i-1) - 1 + randsample ( b - a(i-1) + 1, 1 );
  end

  return
end
