function a = symmetric_random_matrix ( n, d, key )

%*****************************************************************************80
%
%% symmetric_random_matrix() returns the symmetric_random matrix.
%
%  Properties:
%
%    A is symmetric: A' = A.
%
%    The eigenvalues of A will be real.
%
%    Generally, A is not diagonally dominant.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 May 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of A.
%
%    real D(N), the desired eigenvalues for the matrix.
%
%    integer KEY, a positive integer that selects the data.
%
%  Output:
%
%    real A(N,N), the matrix.
%

%
%  Get a random orthogonal matrix Q.
%
  q = orthogonal_random_matrix ( n, key );
%
%  Set A = Q * Lambda * Q'.
%
  l = diag ( d );

  a = q * l * q';

  return
end
